Skip to content

Commit 2a2ad7c

Browse files
authored
Merge branch 'Version2.2' into main
2 parents 854a7f4 + 95e8389 commit 2a2ad7c

1 file changed

Lines changed: 6 additions & 22 deletions

File tree

SystemTester.ps1

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,6 @@ function Test-ToolVerification {
119119

120120
foreach ($tool in $allTools) {
121121
$result = Test-ToolIntegrity -ToolName $tool
122-
if (-not $stats.ContainsKey($result.Status)) {
123-
$stats[$result.Status] = 0
124-
}
125122
$stats[$result.Status]++
126123

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

165162
$totalIssues = $stats.BAD_SIZE + $stats.BAD_SIGNATURE + $stats.MISSING + $stats.CHECK_FAILED
166-
if ($totalIssues -eq 0 -and ($stats.VALID_MS + $stats.VALID_OTHER + $stats.NOT_SIGNED) -gt 0) {
163+
if ($totalIssues -eq 0 -and $stats.VALID_MS -gt 0) {
167164
Write-Host "STATUS: All present tools are verified and safe to use" -ForegroundColor Green
168-
Write-Host ""
169-
return $true
170-
}
171-
172-
if ($totalIssues -gt 0) {
165+
} elseif ($totalIssues -gt 0) {
173166
Write-Host "STATUS: $totalIssues issue(s) detected - recommend re-download" -ForegroundColor Yellow
174167
if ($script:LaunchedViaBatch) {
175168
Write-Host "ACTION: Use Batch Menu Option 5 to re-download tools" -ForegroundColor Yellow
176169
}
177-
Write-Host ""
178-
return $false
179-
}
180-
181-
Write-Host "STATUS: No tools were successfully verified" -ForegroundColor Yellow
182-
Write-Host " Ensure Sysinternals Suite is installed" -ForegroundColor Yellow
183-
if ($script:LaunchedViaBatch) {
184-
Write-Host "ACTION: Use Batch Menu Option 5 to download tools" -ForegroundColor Yellow
185170
}
186171
Write-Host ""
187-
return $false
188172
}
189173

190174
# Initialize environment
@@ -284,7 +268,7 @@ function Convert-ToolOutput {
284268
}
285269

286270
# Run tool
287-
function Invoke-Tool {
271+
function Run-Tool {
288272
param(
289273
[string]$ToolName,
290274
[Alias('Args')]
@@ -312,13 +296,13 @@ function Invoke-Tool {
312296
try {
313297
$start = Get-Date
314298
if ($ToolName -in @("psinfo","pslist","handle","autorunsc","testlimit","contig")) {
315-
$ArgumentList = "-accepteula $ArgumentList"
299+
$Args = "-accepteula $Args"
316300
}
317301

318-
$argArray = if ($ArgumentList.Trim()) { $ArgumentList.Split(' ') | Where-Object { $_ } } else { @() }
302+
$argArray = if ($Args.Trim()) { $Args.Split(' ') | Where-Object { $_ } } else { @() }
319303
$rawOutput = & $toolPath $argArray 2>&1 | Out-String
320304
$duration = ((Get-Date) - $start).TotalMilliseconds
321-
$cleanOutput = Convert-ToolOutput -ToolName $ToolName -RawOutput $rawOutput
305+
$cleanOutput = Clean-ToolOutput -ToolName $ToolName -RawOutput $rawOutput
322306

323307
$script:TestResults += @{
324308
Tool=$ToolName; Description=$Description

0 commit comments

Comments
 (0)