4

When I sleep my computer, it always wakes unexpectedly. When checking what devices are allowed to wake it up I have this list.

PS C:\> powercfg /devicequery wake_armed

HID-compliant mouse
HID-compliant mouse (001)
Realtek PCIe GbE Family Controller
HID Keyboard Device (007)
HID Keyboard Device (008)
Razer DeathAdder V2 Pro (006)
Razer DeathAdder V2 Pro (007)
HID Keyboard Device (009)
HID Keyboard Device (010)

I used powercfg /DEVICEDISABLEWAKE to remove all the items that could have been causing unexpected wake up calls and now I have this:

PS C:\> powercfg /devicequery wake_armed

Realtek PCIe GbE Family Controller

My computer is now able to sleep peacefully until I hit the power button however, like most people, I tend to buy devices I can plug into my PC via USB.

It's a little annoying having to manually include items into this list and I would rather just have it such that the entire USB Host Controller was not allowed to wake my PC.

That might have some unintended consequences so is it possible to just have a blanket rule that only allows for wake up from sleep if the power button is pressed (or magic packet via ethernet).

Or is there perhaps a way to enter devices into an allow-list of devices "allowed to wake up my computer" rather than have them automatically allowed to?

1 Answer 1

0

I had the same problem, where I needed to deactivate all the devices, because my PC was randomly waking up from sleep. (Windows 10)

I wrote a little powershell script to automate the process. Hope it helps:

$wakeDevices = powercfg -devicequery wake_armed

if ($wakeDevices -eq "NONE") {
    Write-Host "No devices found that can wake the PC from sleep."
    exit
}

foreach ($deviceID in $wakeDevices) {
    if ([string]::IsNullOrWhiteSpace($deviceID)) {
        # No idea why, but sometimes the deviceID is empty
        continue
    }

    $confirmMessage = "Do you want to disable the device [$deviceID] (Y/N)"
    $response = Read-Host -Prompt $confirmMessage

    if ($response -eq "Y" -or $response -eq "y") {
        Write-Host "Disabling device [$deviceID]"
        powercfg -devicedisablewake $deviceID
    }
}

Write-Host "Done."

Save the code as ps1 file and run it from powershell (as administrator).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .