Skip to content

Commit 0f3edff

Browse files
authored
Update year in header and adjust report paths
1 parent 8b7d6ac commit 0f3edff

1 file changed

Lines changed: 22 additions & 7 deletions

File tree

SystemTester.ps1

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Portable Sysinternals System Tester
2-
# Created by Pacific Northwest Computers - 2025
2+
# Created by Pacific Northwest Computers - 2026
33
# Complete Production Version - v2.4
44

55
param([switch]$AutoRun)
@@ -1217,7 +1217,9 @@ function Test-Power {
12171217
} catch { $lines += "No battery (desktop)" }
12181218

12191219
if ($script:IsAdmin) {
1220-
$report = Join-Path $ScriptRoot "energy-report.html"
1220+
$reportsDir = Join-Path $ScriptRoot "Reports"
1221+
if (!(Test-Path $reportsDir)) { New-Item -ItemType Directory -Path $reportsDir -Force | Out-Null }
1222+
$report = Join-Path $reportsDir "energy-report.html"
12211223
Write-Host "Generating energy report ($script:ENERGY_DURATION sec)..." -ForegroundColor Yellow
12221224
powercfg /energy /output $report /duration $script:ENERGY_DURATION 2>&1 | Out-Null
12231225
if (Test-Path $report) {
@@ -1332,19 +1334,32 @@ function Test-WindowsUpdate {
13321334
function New-Report {
13331335
Write-Host "`nGenerating reports..." -ForegroundColor Cyan
13341336

1335-
# Test write access
1336-
$testFile = Join-Path $ScriptRoot "writetest_$([guid]::NewGuid().ToString('N')).tmp"
1337+
# Ensure Reports subfolder exists
1338+
$ReportsDir = Join-Path $ScriptRoot "Reports"
1339+
if (!(Test-Path $ReportsDir)) {
1340+
try {
1341+
New-Item -ItemType Directory -Path $ReportsDir -Force | Out-Null
1342+
Write-Host "Created Reports folder: $ReportsDir" -ForegroundColor DarkGray
1343+
} catch {
1344+
Write-Host "ERROR: Cannot create Reports folder: $ReportsDir" -ForegroundColor Red
1345+
Write-Host " $($_.Exception.Message)" -ForegroundColor Red
1346+
return
1347+
}
1348+
}
1349+
1350+
# Test write access to Reports folder
1351+
$testFile = Join-Path $ReportsDir "writetest_$([guid]::NewGuid().ToString('N')).tmp"
13371352
try {
13381353
"test" | Out-File -FilePath $testFile -ErrorAction Stop
13391354
Remove-Item $testFile -ErrorAction Stop
13401355
} catch {
1341-
Write-Host "ERROR: Cannot write to $ScriptRoot" -ForegroundColor Red
1356+
Write-Host "ERROR: Cannot write to Reports folder: $ReportsDir" -ForegroundColor Red
13421357
return
13431358
}
13441359

13451360
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
1346-
$cleanPath = Join-Path $ScriptRoot "SystemTest_Clean_$timestamp.txt"
1347-
$detailedPath = Join-Path $ScriptRoot "SystemTest_Detailed_$timestamp.txt"
1361+
$cleanPath = Join-Path $ReportsDir "SystemTest_Clean_$timestamp.txt"
1362+
$detailedPath = Join-Path $ReportsDir "SystemTest_Detailed_$timestamp.txt"
13481363

13491364
# Calculate stats
13501365
$success = ($TestResults | Where-Object {$_.Status -eq "SUCCESS"}).Count

0 commit comments

Comments
 (0)