Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions SystemTester.bat
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,16 @@ echo.
pause
echo.
:: Call the PowerShell function for tool verification
powershell -NoProfile -ExecutionPolicy Bypass -Command "try { . '%SCRIPT_PS1%'; Test-ToolVerification; exit 0 } catch { Write-Error $_; exit 1 }"
if errorlevel 1 (
echo.
echo [ERROR] Verification encountered an issue. Review output above.
powershell -NoProfile -ExecutionPolicy Bypass -Command "try { . ""%SCRIPT_PS1%""; if (-not (Test-ToolVerification)) { exit 2 } else { exit 0 } } catch { Write-Error $_; exit 1 }"
set "VERIFY_CODE=%errorlevel%"
echo.
if "%VERIFY_CODE%"=="0" (
echo Verification complete. All tools validated successfully.
) else if "%VERIFY_CODE%"=="2" (
echo [WARNING] Verification completed with issues detected. Review output above.
echo Use Menu Option 5 to re-download the Sysinternals Suite.
) else (
echo.
echo Verification complete.
echo [ERROR] Verification encountered an issue. Review output above.
)
echo.
pause
Expand Down
20 changes: 18 additions & 2 deletions SystemTester.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ function Test-ToolVerification {

foreach ($tool in $allTools) {
$result = Test-ToolIntegrity -ToolName $tool
if (-not $stats.ContainsKey($result.Status)) {
$stats[$result.Status] = 0
}
$stats[$result.Status]++

$color = switch ($result.Status) {
Expand Down Expand Up @@ -160,15 +163,28 @@ function Test-ToolVerification {
Write-Host ""

$totalIssues = $stats.BAD_SIZE + $stats.BAD_SIGNATURE + $stats.MISSING + $stats.CHECK_FAILED
if ($totalIssues -eq 0 -and $stats.VALID_MS -gt 0) {
if ($totalIssues -eq 0 -and ($stats.VALID_MS + $stats.VALID_OTHER + $stats.NOT_SIGNED) -gt 0) {
Write-Host "STATUS: All present tools are verified and safe to use" -ForegroundColor Green
} elseif ($totalIssues -gt 0) {
Write-Host ""
return $true
Comment on lines 165 to +169
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep unsigned tool sets as a warning

The new success condition returns $true when there are no size/signature errors and any tools were processed, even if every tool ended up in the NOT_SIGNED or VALID_OTHER buckets. In that scenario the batch launcher now exits with code 0 and prints “All tools validated successfully”, which implies the binaries are trustworthy even though none of them carry a Microsoft signature. The previous logic withheld a success status unless at least one Microsoft-signed tool was found. To avoid a false sense of safety, the function should still return $false (and therefore exit with code 2) when VALID_MS is zero so the caller can flag the result as a warning.

Useful? React with 👍 / 👎.

}

if ($totalIssues -gt 0) {
Write-Host "STATUS: $totalIssues issue(s) detected - recommend re-download" -ForegroundColor Yellow
if ($script:LaunchedViaBatch) {
Write-Host "ACTION: Use Batch Menu Option 5 to re-download tools" -ForegroundColor Yellow
}
Write-Host ""
return $false
}

Write-Host "STATUS: No tools were successfully verified" -ForegroundColor Yellow
Write-Host " Ensure Sysinternals Suite is installed" -ForegroundColor Yellow
if ($script:LaunchedViaBatch) {
Write-Host "ACTION: Use Batch Menu Option 5 to download tools" -ForegroundColor Yellow
}
Write-Host ""
return $false
}

# Initialize environment
Expand Down
Loading