Mordorah
New Member
- Joined
- Apr 22, 2025
- Messages
- 9 (1.13/day)
Would be cool if implemented.
Here is a ready to go code that i use for myself. Should be able to be used on all Nvidia GPU's.
Copy and paste in PowerShell if you want to give it a whirl.
Here is a ready to go code that i use for myself. Should be able to be used on all Nvidia GPU's.
Copy and paste in PowerShell if you want to give it a whirl.
Code:
Set-ExecutionPolicy Unrestricted -Scope Process -Force
# Auto-detect the first NVIDIA GPU
$gpuInfo = Get-PnpDevice -Class Display | Where-Object { $_.FriendlyName -like "*NVIDIA*" } | Select-Object -First 1
if (-not $gpuInfo) {
Write-Host "No NVIDIA GPU found in Device Manager."
Read-Host -Prompt "Press Enter to exit"
exit 1
}
$gpuName = $gpuInfo.FriendlyName
Write-Host "Detected GPU: $gpuName"
# Ensure admin rights
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Host "Please run this script as Administrator."
Read-Host -Prompt "Press Enter to exit"
exit 1
}
# Get GPU class GUID
$classGuid = $gpuInfo.ClassGuid.Trim('{}')
Write-Host "Found Class GUID: {$classGuid}"
$classGuid | Set-Clipboard
$baseRegPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Class\{$classGuid}"
Write-Host "Searching for matching subkey under: $baseRegPath"
# Search for correct subkey by DriverDesc
$matchingPath = $null
Get-ChildItem -Path $baseRegPath -ErrorAction SilentlyContinue | ForEach-Object {
try {
$driverDesc = (Get-ItemProperty -Path $_.PSPath -Name "DriverDesc" -ErrorAction Stop).DriverDesc
if ($driverDesc -eq $gpuName) {
$matchingPath = $_.PSPath
}
} catch {
# Ignore missing DriverDesc
}
}
if (-not $matchingPath) {
Write-Host "No matching DriverDesc found for '$gpuName'."
Read-Host -Prompt "Press Enter to exit"
exit 1
}
Write-Host "Found matching registry key: $matchingPath"
# Write or update DisableDynamicPstate
try {
if (Get-ItemProperty -Path $matchingPath -Name "DisableDynamicPstate" -ErrorAction SilentlyContinue) {
Write-Host "Updating DisableDynamicPstate to 1..."
Set-ItemProperty -Path $matchingPath -Name "DisableDynamicPstate" -Value 1
} else {
Write-Host "Creating DisableDynamicPstate with value 1..."
New-ItemProperty -Path $matchingPath -Name "DisableDynamicPstate" -Value 1 -PropertyType DWord -Force
}
Write-Host "Registry update complete!"
} catch {
Write-Host "Failed to update registry: $_"
}
Read-Host -Prompt "Press Enter to exit"