Skip to content

Commit 451bfa7

Browse files
authored
Enhance PowerShell script verification and download logic
Refactor PowerShell script checks and download process to improve error handling and support for VPN/proxy environments.
1 parent c691b27 commit 451bfa7

1 file changed

Lines changed: 43 additions & 34 deletions

File tree

SystemTester.bat

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ echo.
8383
set "SCRIPT_DIR=%cd%"
8484
set "DRIVE_LETTER=%~d0"
8585

86-
:: Locate PowerShell script (single supported name)
86+
:: Locate PowerShell script
8787
set "SCRIPT_PS1=%SCRIPT_DIR%\SystemTester.ps1"
8888
set "SCRIPT_PS1_NAME=SystemTester.ps1"
8989

@@ -101,22 +101,20 @@ echo Path length: %PATH_LENGTH% characters
101101
echo.
102102

103103
:: Verify PowerShell script exists
104-
if "%SCRIPT_PS1%"=="" (
105-
echo [ERROR] PowerShell script not found in: %SCRIPT_DIR%
104+
if not exist "%SCRIPT_PS1%" (
105+
echo [ERROR] PowerShell script not found: %SCRIPT_PS1%
106106
echo.
107-
echo Expected one of the following files:
108-
echo - SystemTester.ps1
109-
echo - SystemTester.ps1
107+
echo Expected file: SystemTester.ps1
110108
echo.
111-
echo If you renamed the script, restore one of the supported names.
109+
echo Make sure SystemTester.ps1 is in the same folder as this batch file.
112110
echo.
113111
pause
114112
exit /b 1
115113
)
116114

117115
echo Using PowerShell script: %SCRIPT_PS1_NAME%
118116
if "%ST_DEBUG%"=="1" (
119-
echo [%DATE% %TIME%] Using PS1: "%SCRIPT_PS1%" ^(exists: ^<^%SCRIPT_PS1%^^?^) >> "%LAUNCH_LOG%"
117+
echo [%DATE% %TIME%] Using PS1: "%SCRIPT_PS1%" >> "%LAUNCH_LOG%"
120118
)
121119
echo.
122120

@@ -248,20 +246,10 @@ echo of all Sysinternals tools in your installation.
248246
echo.
249247
pause
250248
echo.
251-
:: Call the PowerShell function for tool verification
252-
powershell -NoProfile -ExecutionPolicy Bypass -Command "try { . ""%SCRIPT_PS1%""; if (-not (Test-ToolVerification)) { exit 2 } else { exit 0 } } catch { Write-Error $_; exit 1 }"
253-
set "VERIFY_CODE=%errorlevel%"
249+
powershell -NoProfile -ExecutionPolicy Bypass -Command "try { . ""%SCRIPT_PS1%""; Test-ToolVerification } catch { Write-Error $_; exit 1 }"
254250
echo.
255-
if "%VERIFY_CODE%"=="0" (
256-
echo Verification complete. All tools validated successfully.
257-
) else (
258-
if "%VERIFY_CODE%"=="2" (
259-
echo [WARNING] Verification completed with issues detected. Review output above.
260-
echo Use Menu Option 5 to re-download the Sysinternals Suite.
261-
) else (
262-
echo [ERROR] Verification encountered an issue. Review output above.
263-
)
264-
)
251+
echo Verification complete. Review output above.
252+
echo If issues were found, use Menu Option 5 to re-download.
265253
echo.
266254
pause
267255
goto MENU
@@ -284,7 +272,24 @@ if /i not "%confirm%"=="Y" goto MENU
284272

285273
echo.
286274
echo Downloading...
287-
powershell -NoProfile -ExecutionPolicy Bypass -Command "$ProgressPreference='SilentlyContinue'; try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $iwc = Get-Command Invoke-WebRequest -ErrorAction SilentlyContinue; $p = @{ Uri = '%DOWNLOAD_URL%'; OutFile = '%ZIP_FILE%' }; if ($iwc -and $iwc.Parameters.ContainsKey('UseBasicParsing')) { $p.UseBasicParsing = $true }; if ($iwc -and $iwc.Parameters.ContainsKey('TimeoutSec')) { $p.TimeoutSec = %DOWNLOAD_TIMEOUT_SEC% }; Invoke-WebRequest @p; Write-Host 'Download complete' -ForegroundColor Green } catch { Write-Host ('ERROR: ' + $_.Exception.Message) -ForegroundColor Red; exit 1 }"
275+
:: FIX v2.4: Added SSL bypass callback to handle VPN/proxy environments (e.g. Mullvad, Tailscale)
276+
:: that perform TLS interception, which previously caused download failures.
277+
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
278+
"$ProgressPreference='SilentlyContinue';" ^
279+
"try {" ^
280+
" [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;" ^
281+
" [Net.ServicePointManager]::ServerCertificateValidationCallback = { $true };" ^
282+
" $iwc = Get-Command Invoke-WebRequest -ErrorAction SilentlyContinue;" ^
283+
" $p = @{ Uri = '%DOWNLOAD_URL%'; OutFile = '%ZIP_FILE%' };" ^
284+
" if ($iwc -and $iwc.Parameters.ContainsKey('UseBasicParsing')) { $p.UseBasicParsing = $true };" ^
285+
" if ($iwc -and $iwc.Parameters.ContainsKey('TimeoutSec')) { $p.TimeoutSec = %DOWNLOAD_TIMEOUT_SEC% };" ^
286+
" Invoke-WebRequest @p;" ^
287+
" [Net.ServicePointManager]::ServerCertificateValidationCallback = $null;" ^
288+
" Write-Host 'Download complete' -ForegroundColor Green" ^
289+
"} catch {" ^
290+
" [Net.ServicePointManager]::ServerCertificateValidationCallback = $null;" ^
291+
" Write-Host ('ERROR: ' + $_.Exception.Message) -ForegroundColor Red; exit 1" ^
292+
"}"
288293

289294
if errorlevel 1 (
290295
echo.
@@ -351,7 +356,7 @@ echo --------------------------------------------------------
351356
echo.
352357
echo 1. GPU-Z (TechPowerUp) - Detailed GPU monitoring
353358
echo 2. Check NVIDIA Drivers/Tools
354-
echo 3. Check AMD Drivers/Tools
359+
echo 3. Check AMD Drivers/Tools
355360
echo 4. Download Recommendations
356361
echo 5. Return to Main Menu
357362
echo.
@@ -640,12 +645,13 @@ echo HELP / TROUBLESHOOTING GUIDE v%SCRIPT_VERSION%
640645
echo ========================================================
641646
echo.
642647
echo NEW IN v2.4:
643-
echo - Tool integrity verification (digital signatures)
644-
echo - Dual report system (Clean + Detailed)
645-
echo - Fixed memory usage calculation bug
646-
echo - Launcher awareness detection
647-
echo - Enhanced GPU testing with vendor-specific tools
648-
echo - GPU Tools Manager (Menu Option 6)
648+
echo - Fixed Test-NetConnection port=0 error (latency test)
649+
echo - Fixed SSL/TLS download failure under VPN/proxy (Mullvad, Tailscale)
650+
echo - Multiple fallback URLs for internet speed test
651+
echo - Fixed PsPing latency parsing (flexible regex)
652+
echo - Virtual/VPN adapters no longer flagged as slow NICs
653+
echo - Report files now use ASCII encoding (no more garbled bullets)
654+
echo - Removed stale legacy script name reference
649655
echo.
650656
echo --------------------------------------------------------
651657
echo COMMON ISSUES:
@@ -661,14 +667,17 @@ echo 3. TOOLS MAY BE CORRUPTED
661667
echo Solution: Use Menu Option 4 to verify integrity
662668
echo Then Option 5 to re-download if needed
663669
echo.
664-
echo 4. DOWNLOAD FAILS
665-
echo Causes: Firewall, proxy, no internet
666-
echo Solution: Manual download from:
670+
echo 4. DOWNLOAD FAILS (SSL/TLS error)
671+
echo Cause: VPN or proxy performing TLS inspection
672+
echo This is auto-handled in v2.4 for most cases.
673+
echo Manual fallback:
667674
echo https://download.sysinternals.com/files/SysinternalsSuite.zip
668675
echo Extract to: %SCRIPT_DIR%\Sysinternals\
669676
echo.
670-
echo 5. MEMORY SHOWS 100%% (but Task Manager shows less)
671-
echo This was a bug in v2.08 - FIXED in v2.4
677+
echo 5. NETWORK SPEED TEST FAILS
678+
echo Cause: Firewall, VPN, or no internet
679+
echo v2.4 tries 3 different servers automatically.
680+
echo If all fail, check firewall/proxy settings.
672681
echo.
673682
echo 6. TESTS TAKE TOO LONG
674683
echo Expected durations:

0 commit comments

Comments
 (0)