If you don’t want Windows to turn off a device to save power (for example an Xbox controller), you can untick “Allow the computer to turn off this device to save power” in Device Manager. To do it automatically, set this registry value:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_xxxx&PID_yyyy\[ID]\Device Parameters\WDF\IdleInWorkingState = 0   (REG_DWORD)

Replace xxxx/yyyy with the vendor and product ID of your device.

Example: Xbox controller

Get-Item 'HKLM:\SYSTEM\CurrentControlSet\Enum\USB\VID_045E&PID_02DD\*\Device Parameters\WDF\'
Name  Property
----  --------
WDF   IdleInWorkingState : 1
      WakeFromSleepState : 1

Set it to 0 for every instance:

Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Enum\USB\VID_045E&PID_02DD\*\Device Parameters\WDF\' |
    ForEach-Object {
        Set-ItemProperty -Path $_.PSPath -Name 'IdleInWorkingState' -Value 0 -Type DWord   # -WhatIf
    }

After a reboot the checkbox is gone from the device’s power management tab and the device stays always on.

Device Manager: power management tab without the power saving checkbox

Originally published on anyresearch.net. These are notes from real-world admin work – test before you use them in production.