check that reg property exists

This commit is contained in:
2022-11-23 15:52:49 -05:00
parent 10bd04c73d
commit 855f186aba
+12 -5
View File
@@ -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"