@@ -570,10 +570,21 @@ function Test-Trim {
570570 }
571571 $txt = $map.GetEnumerator () | ForEach-Object {
572572 $status = if ($_.Value -eq " 0" ) { " Enabled" } else { " Disabled" }
573- " $ ( $_.Key ) : $status "
573+ " $ ( $_.Key ) : TRIM $status "
574574 }
575575 if (-not $txt ) { $txt = @ (" TRIM status unknown" ) }
576576
577+ if ($map.Count -gt 0 ) {
578+ $enabledCount = ($map.GetEnumerator () | Where-Object { $_.Value -eq " 0" }).Count
579+ if ($enabledCount -eq $map.Count ) {
580+ $txt += " Overall: TRIM is ENABLED"
581+ } elseif ($enabledCount -eq 0 ) {
582+ $txt += " Overall: TRIM is DISABLED"
583+ } else {
584+ $txt += " Overall: TRIM mixed (check per-filesystem status)"
585+ }
586+ }
587+
577588 $script :TestResults += @ {
578589 Tool = " SSD-TRIM" ; Description = " TRIM status"
579590 Status = " SUCCESS" ; Output = ($txt -join " `n " ); Duration = 50
@@ -842,17 +853,25 @@ function Test-GPU {
842853 $gpus = Get-CimInstance Win32_VideoController
843854 foreach ($gpu in $gpus ) {
844855 if ($gpu.Name ) {
845- $year = if ($gpu.DriverDate ) {
846- ([DateTime ]$gpu.DriverDate ).Year
847- } else {
848- 2020
856+ $driverYear = $null
857+ if ($gpu.DriverDate ) {
858+ try {
859+ $driverYear = ([DateTime ]$gpu.DriverDate ).Year
860+ } catch {
861+ $driverYear = $null
862+ }
849863 }
850-
851- $featureLevel = if ($year -ge 2020 ) { " 12_x" }
852- elseif ($year -ge 2016 ) { " 12_0" }
853- elseif ($year -ge 2012 ) { " 11_0" }
864+
865+ if (-not $driverYear ) {
866+ # Fall back to a conservative default if parsing fails
867+ $driverYear = 2014
868+ }
869+
870+ $featureLevel = if ($driverYear -ge 2020 ) { " 12_x" }
871+ elseif ($driverYear -ge 2016 ) { " 12_0" }
872+ elseif ($driverYear -ge 2012 ) { " 11_0" }
854873 else { " 10_x" }
855-
874+
856875 $capabilities += " $ ( $gpu.Name ) : Likely supports DirectX $featureLevel "
857876 }
858877 }
@@ -907,23 +926,43 @@ function Test-GPUVendorSpecific {
907926
908927 # Check for AMD
909928 try {
910- $amdRegistry = " HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0000"
911-
912- if (Test-Path $amdRegistry ) {
913- $amdInfo = Get-ItemProperty $amdRegistry - ErrorAction Stop
914-
915- $amdOutput = @ ()
916- $amdOutput += " AMD GPU Detected"
917- $amdOutput += " Driver Description: $ ( $amdInfo.DriverDesc ) "
918- $amdOutput += " Driver Version: $ ( $amdInfo.DriverVersion ) "
919- $amdOutput += " Driver Date: $ ( $amdInfo.DriverDate ) "
920-
921- if ($amdInfo.DriverDesc -match " AMD|Radeon" ) {
929+ $amdClassRoot = " HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}"
930+
931+ if (Test-Path $amdClassRoot ) {
932+ $amdOutputs = @ ()
933+ $detected = $false
934+
935+ $subKeys = Get-ChildItem $amdClassRoot - ErrorAction SilentlyContinue | Where-Object { $_.PSChildName -match " ^\d{4}$" }
936+ foreach ($subKey in $subKeys ) {
937+ try {
938+ $amdInfo = Get-ItemProperty $subKey.PSPath - ErrorAction Stop
939+ } catch {
940+ continue
941+ }
942+
943+ if ($amdInfo.DriverDesc -and $amdInfo.DriverDesc -match " AMD|Radeon" ) {
944+ $detected = $true
945+ $amdOutputs += " AMD GPU Slot $ ( $subKey.PSChildName ) "
946+ $amdOutputs += " Driver Description: $ ( $amdInfo.DriverDesc ) "
947+ if ($amdInfo.DeviceDesc ) { $amdOutputs += " Device: $ ( $amdInfo.DeviceDesc ) " }
948+ if ($amdInfo.DriverVersion ) { $amdOutputs += " Driver Version: $ ( $amdInfo.DriverVersion ) " }
949+ if ($amdInfo.DriverDate ) { $amdOutputs += " Driver Date: $ ( $amdInfo.DriverDate ) " }
950+ $amdOutputs += " "
951+ }
952+ }
953+
954+ if ($detected ) {
922955 $script :TestResults += @ {
923956 Tool = " AMD-GPU" ; Description = " AMD GPU information"
924- Status = " SUCCESS" ; Output = ($amdOutput -join " `n " ); Duration = 100
957+ Status = " SUCCESS" ; Output = ($amdOutputs -join " `n " ); Duration = 150
925958 }
926959 Write-Host " AMD GPU information collected" - ForegroundColor Green
960+ } else {
961+ Write-Host " AMD GPU not detected" - ForegroundColor DarkGray
962+ $script :TestResults += @ {
963+ Tool = " AMD-GPU" ; Description = " AMD GPU information"
964+ Status = " SKIPPED" ; Output = " No AMD GPU detected" ; Duration = 0
965+ }
927966 }
928967 } else {
929968 Write-Host " AMD GPU not detected" - ForegroundColor DarkGray
@@ -1052,6 +1091,8 @@ function Test-HardwareEvents {
10521091function Test-WindowsUpdate {
10531092 Write-Host " `n === Windows Update ===" - ForegroundColor Green
10541093 $updateSession = $null
1094+ $searcher = $null
1095+ $result = $null
10551096 try {
10561097 $lines = @ ()
10571098 try {
@@ -1080,6 +1121,12 @@ function Test-WindowsUpdate {
10801121 } catch {
10811122 Write-Host " Windows Update check failed" - ForegroundColor Yellow
10821123 } finally {
1124+ if ($result ) {
1125+ try { [System.Runtime.InteropServices.Marshal ]::ReleaseComObject($result ) | Out-Null } catch {}
1126+ }
1127+ if ($searcher ) {
1128+ try { [System.Runtime.InteropServices.Marshal ]::ReleaseComObject($searcher ) | Out-Null } catch {}
1129+ }
10831130 if ($updateSession ) {
10841131 try { [System.Runtime.InteropServices.Marshal ]::ReleaseComObject($updateSession ) | Out-Null } catch {}
10851132 }
@@ -1338,14 +1385,16 @@ function Generate-Report {
13381385
13391386 # === GPU HEALTH ===
13401387 if ($gpuDetails ) {
1341- if ($gpuDetails.Output -match " Driver Date:.*(\d{4})" ) {
1342- $driverYear = [int ]$matches [1 ]
1343- $currentYear = (Get-Date ).Year
1344- if ($currentYear - $driverYear -gt 1 ) {
1345- $recommendations += " • INFO: GPU drivers are over 1 year old"
1346- $recommendations += " → Update to latest drivers for best performance"
1347- $recommendations += " → NVIDIA: GeForce Experience or nvidia.com"
1348- $recommendations += " → AMD: amd.com/en/support"
1388+ if ($gpuDetails.Output -match " Driver Date:.*?(\d{4})" ) {
1389+ $driverYear = 0
1390+ if ([int ]::TryParse($matches [1 ], [ref ]$driverYear )) {
1391+ $currentYear = (Get-Date ).Year
1392+ if ($currentYear - $driverYear -gt 1 ) {
1393+ $recommendations += " • INFO: GPU drivers are over 1 year old"
1394+ $recommendations += " → Update to latest drivers for best performance"
1395+ $recommendations += " → NVIDIA: GeForce Experience or nvidia.com"
1396+ $recommendations += " → AMD: amd.com/en/support"
1397+ }
13491398 }
13501399 }
13511400 }
0 commit comments