104 lines
3.7 KiB
PowerShell
104 lines
3.7 KiB
PowerShell
[Console]::OutputEncoding = [Text.Encoding]::UTF8
|
|
$ErrorActionPreference = 'Continue'
|
|
|
|
Write-Host "[*] Installing essential applications"
|
|
Write-Host "Apps: AnyDesk, LINE, Chrome, 7zip, Adobe Reader"
|
|
Write-Host ""
|
|
|
|
# Install via winget (preferred method)
|
|
$apps = @(
|
|
@{Name="AnyDesk"; WingetId="AnyDeskSoftwareGmbH.AnyDesk"}
|
|
@{Name="LINE"; WingetId="LINE.LINE"}
|
|
@{Name="Google Chrome"; WingetId="Google.Chrome"}
|
|
@{Name="7-Zip"; WingetId="7zip.7zip"}
|
|
@{Name="Adobe Reader"; WingetId="Adobe.Acrobat.Reader.64-bit"}
|
|
)
|
|
|
|
$successCount = 0
|
|
$totalApps = $apps.Count
|
|
|
|
foreach ($app in $apps) {
|
|
Write-Host "Installing $($app.Name)..."
|
|
|
|
try {
|
|
$result = & winget install $app.WingetId --accept-package-agreements --accept-source-agreements --silent 2>&1
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host " [OK] $($app.Name) installed successfully"
|
|
$successCount++
|
|
} else {
|
|
Write-Host " [SKIP] $($app.Name) may already be installed or failed"
|
|
# Check if already installed
|
|
$checkResult = & winget list $app.WingetId 2>&1
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host " [INFO] $($app.Name) appears to be already installed"
|
|
$successCount++
|
|
}
|
|
}
|
|
} catch {
|
|
Write-Host " [ERROR] Failed to install $($app.Name)"
|
|
|
|
# Try alternative download for critical apps
|
|
if ($app.Name -eq "Google Chrome") {
|
|
Write-Host " Trying alternative Chrome download..."
|
|
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
|
|
Write-Host " [OK] Chrome installed via direct download"
|
|
$successCount++
|
|
} catch {
|
|
Write-Host " [ERROR] Chrome alternative install failed"
|
|
}
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
}
|
|
|
|
Write-Host "=== Installation Summary ==="
|
|
Write-Host "Successfully installed: $successCount / $totalApps applications"
|
|
Write-Host ""
|
|
|
|
# Verify installations by checking common install locations
|
|
Write-Host "Verification:"
|
|
|
|
$verifyApps = @(
|
|
@{Name="AnyDesk"; Path="C:\Program Files (x86)\AnyDesk\AnyDesk.exe"}
|
|
@{Name="LINE"; Path="C:\Users\$env:USERNAME\AppData\Local\LINE\bin\LineLauncher.exe"}
|
|
@{Name="Chrome"; Path="C:\Program Files\Google\Chrome\Application\chrome.exe"}
|
|
@{Name="7-Zip"; Path="C:\Program Files\7-Zip\7z.exe"}
|
|
@{Name="Adobe Reader"; Path="C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe"}
|
|
)
|
|
|
|
foreach ($app in $verifyApps) {
|
|
if (Test-Path $app.Path) {
|
|
Write-Host " [OK] $($app.Name) - Found at expected location"
|
|
} else {
|
|
# Try to find in registry
|
|
$found = $false
|
|
$regPaths = @(
|
|
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*",
|
|
"HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
|
|
)
|
|
|
|
foreach ($regPath in $regPaths) {
|
|
$installed = Get-ItemProperty $regPath -ErrorAction SilentlyContinue |
|
|
Where-Object { $_.DisplayName -like "*$($app.Name.Split(' ')[0])*" }
|
|
if ($installed) {
|
|
Write-Host " [OK] $($app.Name) - Found in registry"
|
|
$found = $true
|
|
break
|
|
}
|
|
}
|
|
|
|
if (-not $found) {
|
|
Write-Host " [!] $($app.Name) - Not detected"
|
|
}
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "Installation completed!"
|
|
Write-Host "Note: Applications may require restart to appear in Start Menu" |