Skip files that do not exist

This commit is contained in:
Calyx Hikari 2025-08-04 10:28:07 +08:00
parent c2e75e9880
commit 6dc822a57e
3 changed files with 15 additions and 0 deletions

View file

@ -159,6 +159,9 @@ function Main {
# --- Check Signature ---
foreach ($item in $downloads) {
$outFile = Join-Path $tempDir $item.Name
if (-not (Test-Path -Path $outFile)) {
continue
}
Write-Host "Verifying signature of $($item.Name)..."
$signature = Get-AuthenticodeSignature $outFile
if ($signature.SignerCertificate.Subject -like "*CN=Microsoft Corporation*" -and $signature.Status -eq "Valid") {
@ -202,6 +205,9 @@ function Main {
continue
}
$exePath = Join-Path $tempDir $item.Name
if (-not (Test-Path -Path $exePath)) {
continue
}
$arguments = if ($item.Year -in @("2005", "2008")) { "/q" } else { "/quiet /norestart" }
Write-Host "Installing $($item.Name)..."
Start-Process -FilePath $exePath -ArgumentList $arguments -Wait