diff --git a/Fix-EnableGPUScheduling.ps1 b/Fix-EnableGPUScheduling.ps1 index 1d1c58e..b9bb657 100644 --- a/Fix-EnableGPUScheduling.ps1 +++ b/Fix-EnableGPUScheduling.ps1 @@ -2,15 +2,22 @@ $key = "HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers" $name = "HwSchMode" # Check to see if GPU scheduling is enabled -$setting = (Get-ItemPropertyValue -Path $key -Name $name -ErrorAction SilentlyContinue) -If ( $setting -eq 2 ) { - LogMsg "Hardware assisted GPU scheduling is already enabled" - $HardwareGPUSchedulingEnabled = $true + +If ( Test-RegistryProperty -Path $key -Name $name ) { + $setting = (Get-ItemPropertyValue -Path $key -Name $name -ErrorAction SilentlyContinue) + If ( $setting -eq 2 ) { + LogMsg "Hardware assisted GPU scheduling is already enabled" + $HardwareGPUSchedulingEnabled = $true + } Else { + LogMsg "Hardware assisted GPU scheduling is disabled" + $HardwareGPUSchedulingEnabled = $false + } } Else { - LogMsg "Hardware assisted GPU scheduling is not currently enabled" + LogMsg "Hardware assisted GPU scheduling is disabled" $HardwareGPUSchedulingEnabled = $false } + # Find a GPU in the system so we can enable GPU scheduling If ( $HardwareGPUSchedulingEnabled -eq $false ) { LogMsg " - Attempting to find a discrete Nvidia or AMD GPU"