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

3
32
View file

@ -128,6 +128,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") {

6
64
View file

@ -146,6 +146,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") {
@ -179,6 +182,9 @@ function Main {
# --- Install VC++ Redistributables ---
foreach ($item in $downloads | Where-Object { $_.Name -like "vcredist*" }) {
$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

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