major update to override Write-Output func

This commit is contained in:
2023-10-05 13:11:38 -04:00
parent 31a06a9206
commit bbb4884818
52 changed files with 377 additions and 378 deletions
+8 -8
View File
@@ -6,18 +6,18 @@ $HardwareGPUSchedulingEnabled = $false
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"
Write-Output "Hardware assisted GPU scheduling is already enabled"
$HardwareGPUSchedulingEnabled = $true
}
}
If ( $HardwareGPUSchedulingEnabled -eq $false ) {
LogMsg "Hardware assisted GPU scheduling is disabled"
Write-Output "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"
Write-Output " - Attempting to find a discrete Nvidia or AMD GPU"
$GPUs = (Get-WmiObject Win32_VideoController).Name
$FoundDiscreteGPU = $false
ForEach ( $gpu in $GPUs ) {
@@ -28,15 +28,15 @@ If ( $HardwareGPUSchedulingEnabled -eq $false ) {
# If we found a discrete GPU, enable hardware assisted GPU scheduling
If ( $FoundDiscreteGPU -eq $true ) {
LogMsg " - GPU found!"
LogMsg "Enabling hardware assisted GPU scheduling"
Write-Output " - GPU found!"
Write-Output "Enabling hardware assisted GPU scheduling"
Try {
New-ItemProperty -Path $key -Name $name -PropertyType DWord -Value 2 -Force -ErrorAction Stop
LogMsg "A restart is required before this change will take effect"
Write-Output "A restart is required before this change will take effect"
}
Catch { LogErr $_.Exception.Message }
} Else {
LogMsg " - No GPU was found"
LogMsg "Hardware assisted GPU scheduling will not be enabled"
Write-Output " - No GPU was found"
Write-Output "Hardware assisted GPU scheduling will not be enabled"
}
}