From 0805011ac69093129ab6b904f97bb3c935ee2a35 Mon Sep 17 00:00:00 2001 From: Brad Lance Date: Sun, 5 Jul 2026 19:30:08 -0500 Subject: [PATCH] Show a preview of blocked/substituted downloads in Get-WinSCP.ps1 The 1MB size-check catches a bad download but gave no way to see why - on a locked-down network something is very likely substituting a small HTML page (proxy/AV block page) for the real zip. Print the first lines of whatever was actually saved so the content is visible without another round trip. --- Get-WinSCP.ps1 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Get-WinSCP.ps1 b/Get-WinSCP.ps1 index b8046f9..41ef88a 100644 --- a/Get-WinSCP.ps1 +++ b/Get-WinSCP.ps1 @@ -21,8 +21,18 @@ try { $fileInfo = Get-Item $zip if ($fileInfo.Length -lt 1MB) { Write-Host "ERROR: Downloaded file is only $($fileInfo.Length) bytes - too small to be WinSCP." -ForegroundColor Red - Write-Host "This usually means antivirus or a firewall blocked/altered the download instead of letting the real file through." -ForegroundColor Yellow - Write-Host "Try running setup.bat again. If it keeps happening, download WinSCP-6.3.6-Automation.zip manually from winscp.net and unzip it into:" -ForegroundColor Yellow + Write-Host "This usually means antivirus, a firewall, or a web filter intercepted the download and replaced it with a block/warning page instead of letting the real file through." -ForegroundColor Yellow + + $preview = Get-Content -Path $zip -TotalCount 15 -ErrorAction SilentlyContinue + if ($preview) { + Write-Host "" + Write-Host "--- What was actually downloaded (first 15 lines, for troubleshooting) ---" -ForegroundColor Yellow + $preview | ForEach-Object { Write-Host $_ } + Write-Host "--- end ---" -ForegroundColor Yellow + Write-Host "" + } + + Write-Host "Try running setup.bat again. If it keeps happening, ask IT whether winscp.net / sourceforge.net downloads are being blocked, or download WinSCP-6.3.6-Automation.zip manually in a browser and unzip it into:" -ForegroundColor Yellow Write-Host " $dest" -ForegroundColor Yellow Remove-Item $zip -Force exit 1