Solved Disable Power Management for all devices via script


for what its worth, you can successfully change the power management options of the NIC through registry without powershell with this key.

Code:
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\000X" /v "PnPCapabilities" /t REG_DWORD /d "0x00000118"

you can disable it for other devices using the "ultimate performance" power plan. i havent figured out how to do it for the usb controllers though through registry. im looking into finding a way to do it via powercfg commands. ill post back if i find anything. at least there is a powershell solution that works for mostly everyone if someone comes across this thread
 

My Computer

System One

  • OS
    Windows 11 27729
    Computer type
    PC/Desktop
    CPU
    i9 13900kf @5.7ghz all P-Cores
    Motherboard
    Aorus Master Z790
    Memory
    32gb DDR5 7200
    Graphics Card(s)
    RTX 4090
    Other Info
    https://www.github.com/shoober420

My Computer

System One

  • OS
    Windows 11 Pro Version 23H2 (Build: 22631.4317)
    Computer type
    Laptop
    Manufacturer/Model
    Asus Flipbook Q504UAK - BHI5T13 [ Hybrid (2-in-1) Touch ]
    CPU
    7th gen Intel® Core™ i5 - 7200U (3MB Cache, 2.5GHz)
    Motherboard
    ASUS UX560A
    Memory
    16GB => 8GB [on-board] & 8GB Kingston HyperX DDR4 2666MHZ SoDIMM
    Graphics Card(s)
    Intel® HD Graphics 620
    Sound Card
    Harmon/Kardon built-in
    Monitor(s) Displays
    1
    Screen Resolution
    Touchscreen: 39.6 cm (15.6") Full HD 1920 x 1080 pixels Matt 16:9
    Hard Drives
    Samsung 2TB SSD 870 EVO [SATA]; Samsung 1TB SSD 980 PRO [NVMe Gen3];
    Samsung 4TB SSD T7 Shield [Portable]
    PSU
    19v@2.36A 45W - 20v@5.0A 65W PD (USB-C to Barrel plug 4.0mm x 1.35mm)
    Case
    Aluminum
    Cooling
    Standard cooling fan
    Keyboard
    Backlit, built-in keyboard
    Mouse
    Logitech Mice: G502X & G602
    Internet Speed
    802.11ac
    Browser
    Firefox v131.0.2
    Other Info
    Card Reader, WLAN, 802.11a, 802.11b, 802.11g, Wi-Fi 4 (802.11n), Wi-Fi 5 (802.11ac) , Webcam, HDMI x1
Batch:
for /f "delims=" %%a in ('powercfg devicequery wake_armed') do powercfg devicedisablewake "%%a"
 

My Computers

System One System Two

  • OS
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Asus TUF Gaming F16 (2024)
    CPU
    i7 13650HX
    Memory
    16GB DDR5
    Graphics Card(s)
    GeForce RTX 4060 Mobile
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    512GB SSD internal
    37TB external
    PSU
    Li-ion
    Cooling
    2× Arc Flow Fans, 4× exhaust vents, 5× heatpipes
    Keyboard
    Logitech K800
    Mouse
    Logitech G402
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
  • Operating System
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Medion S15450
    CPU
    i5 1135G7
    Memory
    16GB DDR4
    Graphics card(s)
    Intel Iris Xe
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    2TB SSD internal
    37TB external
    PSU
    Li-ion
    Mouse
    Logitech G402
    Keyboard
    Logitech K800
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
Batch:
for /f "delims=" %%a in ('powercfg devicequery wake_armed') do powercfg devicedisablewake "%%a"
nice, but i did unfortunately find out that powercfg cant do the same for the "Allow the computer to turn off this device to save power" option.
 

My Computer

System One

  • OS
    Windows 11 27729
    Computer type
    PC/Desktop
    CPU
    i9 13900kf @5.7ghz all P-Cores
    Motherboard
    Aorus Master Z790
    Memory
    32gb DDR5 7200
    Graphics Card(s)
    RTX 4090
    Other Info
    https://www.github.com/shoober420
nice, but i did unfortunately find out that powercfg cant do the same for the "Allow the computer to turn off this device to save power" option.
powercfg can't, but PowerShell can. However, I wanted to make sure that you will be able to see what are the devices that have that option currently turned on, i.e. as opposed to merely turning it off for all devices that have that option. In addition, I also wanted to make sure that you will be able to revert these changes if needed (just to be on the safe side). Some reports claim that making these changes can tend to hurt system performance so that's why.

The PowerShell script code below outputs the FriendlyName and the InstanceId [of those specific devices that have the option enabled] to the console, writes the InstanceId values to a file, and disables the option for each device. To be able to see the output in the console, you'll have to run this script code in such a way that the console remains open after it finishes. To be able to see the output in the console more clearly, you can resize the PowerShell window to make it wider.
Powershell:
$PSDefaultParameterValues['out-file:width'] = 4096

$devices = Get-PnpDevice -PresentOnly
$checkedDevices = (Get-CimInstance -ClassName MSPower_DeviceEnable -Namespace root\wmi | Where-Object {$_.Enable}).InstanceName

# Save the InstanceId values to a file
$checkedDevices | Out-File -FilePath "checkedDevices.txt"

# Output the FriendlyName and InstanceId values to the console
$checkedDevices | ForEach-Object {
    $id = $_
    $device = $devices | Where-Object {$_.InstanceId + '_0' -eq $id}
    $device | Select-Object FriendlyName, InstanceId
} | Format-Table -AutoSize | Out-String -Width 4096

# Uncheck "Allow the computer to turn off this device to save power" checkbox for each device
$checkedDevices | ForEach-Object {
    Set-CimInstance $_ -Property @{Enable = $false}
}

$PSDefaultParameterValues.Remove('out-file:width')

The PowerShell script code below reads from the file, and uses that to undo the changes made by the PowerShell script code above.
Powershell:
# Read the InstanceId values from the file
$checkedDevices = Get-Content -Path "checkedDevices.txt"

# Check "Allow the computer to turn off this device to save power" checkbox for each device using the InstanceId values from the file
$checkedDevices | ForEach-Object {
    Set-CimInstance $_ -Property @{Enable = $true}
}
 

My Computers

System One System Two

  • OS
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Asus TUF Gaming F16 (2024)
    CPU
    i7 13650HX
    Memory
    16GB DDR5
    Graphics Card(s)
    GeForce RTX 4060 Mobile
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    512GB SSD internal
    37TB external
    PSU
    Li-ion
    Cooling
    2× Arc Flow Fans, 4× exhaust vents, 5× heatpipes
    Keyboard
    Logitech K800
    Mouse
    Logitech G402
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
  • Operating System
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Medion S15450
    CPU
    i5 1135G7
    Memory
    16GB DDR4
    Graphics card(s)
    Intel Iris Xe
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    2TB SSD internal
    37TB external
    PSU
    Li-ion
    Mouse
    Logitech G402
    Keyboard
    Logitech K800
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF

Latest Support Threads

Back
Top Bottom