Harden WinSCP download/unzip with error handling and diagnostics

Expand-Archive was failing with a cryptic "End of Central Directory record
could not be found" on Melissa's PC - the inline one-liner in setup.bat had
no error handling, so a blocked/truncated download (antivirus, firewall, or
an older TLS default) surfaced as a raw .NET exception instead of a useful
message. Moved the logic to Get-WinSCP.ps1: forces TLS 1.2, validates the
downloaded file size before unzipping, and reports what actually went wrong.
This commit is contained in:
2026-07-05 19:22:58 -05:00
parent 83e16ed6cd
commit 3ac8bf287c
2 changed files with 42 additions and 3 deletions
+1 -3
View File
@@ -1,5 +1,3 @@
@echo off
echo Downloading WinSCP...
powershell.exe -ExecutionPolicy Bypass -Command ^
"$url = 'https://winscp.net/download/WinSCP-6.3.6-Automation.zip'; $zip = '%TEMP%\winscp.zip'; $dest = '%~dp0WinSCP'; Invoke-WebRequest -Uri $url -OutFile $zip; Expand-Archive -Path $zip -DestinationPath $dest -Force; Write-Host 'WinSCP ready.' -ForegroundColor Green"
powershell.exe -ExecutionPolicy Bypass -File "%~dp0Get-WinSCP.ps1"
pause