103 lines
4.0 KiB
PowerShell
103 lines
4.0 KiB
PowerShell
[Console]::OutputEncoding = [Text.Encoding]::UTF8
|
|
$ErrorActionPreference = 'Continue'
|
|
|
|
Write-Host "[*] Installing applications using winget (fixed sources)"
|
|
Write-Host ""
|
|
|
|
# Applications to install with explicit winget source
|
|
$apps = @(
|
|
@{Name="Google Chrome"; Id="Google.Chrome"},
|
|
@{Name="7-Zip"; Id="7zip.7zip"},
|
|
@{Name="AnyDesk"; Id="AnyDeskSoftwareGmbH.AnyDesk"},
|
|
@{Name="LINE"; Id="LINE.LINE"},
|
|
@{Name="Adobe Reader"; Id="Adobe.Acrobat.Reader.64-bit"}
|
|
)
|
|
|
|
$installedCount = 0
|
|
$totalApps = $apps.Count
|
|
|
|
Write-Host "Installing $totalApps applications using winget source..."
|
|
Write-Host ""
|
|
|
|
foreach ($app in $apps) {
|
|
Write-Host "[$($installedCount + 1)/$totalApps] Installing $($app.Name)..."
|
|
|
|
try {
|
|
# Install using explicit winget source to avoid msstore certificate issues
|
|
Write-Host " Downloading and installing from winget source..."
|
|
$installResult = & winget install $app.Id --source winget --accept-package-agreements --accept-source-agreements --silent
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host " [OK] $($app.Name) installed successfully"
|
|
$installedCount++
|
|
} else {
|
|
Write-Host " [!] Installation exit code: $LASTEXITCODE"
|
|
|
|
# Try to verify if it was actually installed despite exit code
|
|
Start-Sleep -Seconds 3
|
|
$verifyResult = & winget list $app.Id --source winget 2>$null
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host " [OK] $($app.Name) appears to be installed"
|
|
$installedCount++
|
|
} else {
|
|
Write-Host " [ERROR] $($app.Name) installation failed"
|
|
|
|
# Try alternative approach for some apps
|
|
if ($app.Name -eq "Google Chrome") {
|
|
Write-Host " Trying Chrome enterprise installer..."
|
|
try {
|
|
$chromeUrl = "https://dl.google.com/chrome/install/GoogleChromeStandaloneEnterprise64.msi"
|
|
$chromePath = "$env:TEMP\ChromeSetup.msi"
|
|
Invoke-WebRequest -Uri $chromeUrl -OutFile $chromePath -UseBasicParsing
|
|
& msiexec /i $chromePath /quiet /norestart
|
|
Start-Sleep -Seconds 5
|
|
Remove-Item $chromePath -Force -ErrorAction SilentlyContinue
|
|
Write-Host " [OK] Chrome installed via direct MSI"
|
|
$installedCount++
|
|
} catch {
|
|
Write-Host " [!] Chrome direct install failed"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
} catch {
|
|
Write-Host " [ERROR] Exception: $($_.Exception.Message)"
|
|
}
|
|
|
|
Write-Host ""
|
|
Start-Sleep -Seconds 2
|
|
}
|
|
|
|
Write-Host "=== Installation Summary ==="
|
|
Write-Host "Successfully installed: $installedCount / $totalApps applications"
|
|
Write-Host ""
|
|
|
|
# Final verification
|
|
Write-Host "Final verification:"
|
|
|
|
$verificationChecks = @(
|
|
@{Name="Chrome"; Paths=@("C:\Program Files\Google\Chrome\Application\chrome.exe", "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")},
|
|
@{Name="7-Zip"; Paths=@("C:\Program Files\7-Zip\7z.exe")},
|
|
@{Name="AnyDesk"; Paths=@("C:\Program Files (x86)\AnyDesk\AnyDesk.exe", "C:\Program Files\AnyDesk\AnyDesk.exe")},
|
|
@{Name="Adobe Reader"; Paths=@("C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe", "C:\Program Files\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe")},
|
|
@{Name="LINE"; Paths=@("C:\Users\$env:USERNAME\AppData\Local\LINE\bin\LineLauncher.exe", "C:\Program Files\LINE\bin\LineLauncher.exe")}
|
|
)
|
|
|
|
foreach ($check in $verificationChecks) {
|
|
$found = $false
|
|
foreach ($path in $check.Paths) {
|
|
if (Test-Path $path) {
|
|
Write-Host " [OK] $($check.Name) - Found at $path"
|
|
$found = $true
|
|
break
|
|
}
|
|
}
|
|
if (-not $found) {
|
|
Write-Host " [!] $($check.Name) - Not found"
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "Installation process completed!"
|
|
Write-Host "Note: Some applications may require restart to appear in Start Menu" |