16

Every time I plug in a new mouse/keyboard or plug an existing one to a new USB port, I have to manually go to the device manager, go to the device's property page, and uncheck "Allow this device to wake the computer" on the "Power Management" page. enter image description here

Is it possible to set up a system policy in Windows 7, such that this box is not checked for new USB mice/keyboards by default?

Edit: If there's no way to set up such a system policy, is there at least a way to enumerate and disable USB wake on devices by using powercfg in a batch file?

Edit 2: This has to be possible to do at least using powercfg. powercfg devicequery wake_armed gives a list of all devices that can wake the system. Now how can I feed this list back to powercfg and have it disable the wake on the listed devices?

  • 1
    You can disable this in some BIOS (Legacy and UEFI) – justbrowsing Aug 14 '13 at 1:46
  • My BIOS doesn't have such an option, unfortunately. – Duke Nukem Aug 14 '13 at 21:14
  • My BOIS also does not have this option. Please let us know if you found an answer -- I've been in the habit of turning off my power supply for years, and I'd really like to change that... – Allen Pestaluky Nov 28 '15 at 19:41
4

Edit 2: Clarification

This answer does not solve the problem in question in its original wording. Disabling wake for all future devices does not seem to be possible. The solution in this answer only allows you to disable wake for all currently connected devices.

My original answer:

This question seems to have been answered in another SO answer

for /F "tokens=*" %%A in ('powercfg -devicequery wake_armed') do powercfg -devicedisablewake "%%A"

This needs to be run as an administrator.

Edit:

To provide a more complete solution here is a script that requests administrator privileges before running the above loop. The admin rights are requested using a Microsoft powertoy (written in VisualBasic, unsurprisingly)

@echo off
if "%~1"=="" (
  elevate %0 do
) else if "%~1"=="do" (
  for /F "tokens=*" %%A in ('powercfg -devicequery wake_armed') do (
    if not "%%A"=="NONE" (
      echo Disabling %%A
      powercfg -devicedisablewake "%%A"
    )
  )
  echo All done.
  pause
) else (
  echo Usage: %~nx0
)
| improve this answer | |
  • This will only disable the current configuration of USB devices, not all future configurations like the question asked for. For example, run this script, then unplug a mouse and plug it back in to a new port -- the mouse will now wake from sleep again unless this script is run again for the new USB device configuration. – Allen Pestaluky Nov 28 '15 at 19:34
  • 1
    @AllenPestaluky the question has edits which ask for at least a partial solution if the complete solution is not possible. My answer (and the answer I link to) is exactly the partial solution the OP is asking for. – SnakE Nov 29 '15 at 1:21
  • Thanks, this batch script does exactly what I wanted. I may try to find a way to automate this in the future. Would you happen to know if there's a way to do the powercfg calls through the Windows API, to avoid spawning separate processes? – Duke Nukem Jun 21 '16 at 4:47
  • 1
    @DukeNukem No I'm not aware of such an API. I didn't do any research though so it might still exist. Also all these settings must be in the registry. So you can use the procmon powertoy to trace which registry locations are accessed by powercfg -devicequery wake_armed and write your own registry manipulation tool. – SnakE Jun 23 '16 at 10:58
1

To answer the questions in your edits:

No, you can not use powercfg to enumerate devices to change the default wake behaviour of all future USB configurations like you asked in your original question.

I tried using the For /F "tokens=*" %%A in ('powercfg -devicequery wake_armed') do powercfg -devicedisablewake "%%A" script, but after plugging my USB device into a new port, it defaulted back to waking the computer.

I even tried enumerating the result of powercfg -devicequery wake_from_any, but it seems that you can only enumerate connected USB devices. Even the wake_from_any argument returns a different list each time you change the port your USB device is plugged into.

To to answer your original question:

I have no idea. I really want to know the answer to this, but I still haven't found an answer. If anyone can figure this out, you will be loved dearly! <3

| improve this answer | |
1

[DISCLAIMER] This is not an answer to the OP question but rather a solution to the problem for which you probably ended up here!

Old thread but I came here firstly for a solution which I ended up resolving in another way and now I'm sharing.

[ISSUE] My issue was with an USB device (xbox controller) keeping the PC awake or waking it up as soon as it entered sleep. At first I ended up needing to do what OP was talking about, after that I gave SnaKe script a try.

[SOLUTION] It was solved properly without any hacky scripts or manual controls just by configuring XHCI in bios setting it from SmartAuto to Enabled.

[BITS OF WHY] What this does is forcing the USB on board controller to act as USB3 all the time rather than downgrading to USB2 and then switching to USB3 when OS takes control. Forcing it to behave proven to have solved my issue with the USB device driver misbehaving when trying to transition the PC into sleep/hibernate. Running Windows 10 which has built in drivers for USB3 enabling XHCI mode works greatly, issues may come from forcing it if booting some OS that doesn't have support for USB3.

SmartAuto shouldn't have been an issue to start with because (as stated here) after the first bootup of the computer the controller should stay on USB3 (acting as Enabled) but maybe there is a bug somewhere in it's logic or how sleep state get's considered by the feature and it was behaving as Auto on my Asus motherboard .

| improve this answer | |
  • This fixed my problem with a Logitech receiver on an ASUS laptop. After this BIOS fix (I picked Disabled), I also had to turn off each device's ability to wake the computer in Device Manager again. – Jim Hunziker Dec 13 '19 at 12:39
  • careful though, by picking Disable you basically disabled USB 3.0 and using USB 2.0 on all ports – Cody May 6 at 2:24
-1

This seems a known issue documentation can be found here Summary:

Workaround 1 (Recommended)

Plug the USB device into an Enhanced Host Controller Interface (EHCI) host controller.

Workaround 2

Disable the USB device's ability to wake the computer. To do this, follow these steps:

Click Start
Start button
, right-click Computer, and then click Manage.
In the User Account Control dialog box, click Continue.

User Account Control permission
If you are prompted for an administrator password or for a confirmation, type the password, or click Allow.
Click Device Manager, expand Universal Serial Bus controllers, right-click the device, and then click Properties.
Click the Power Management tab, disable the Allow this device to wake the computer check box, and then click OK.

Note We recommend that you use Workaround 1 because it preserves the wake functionality. When you use Workaround 2, USB devices cannot wake the computer. Additionally, the remote control power button for a Windows Media Center IR receiver cannot wake the computer.

| improve this answer | |
  • 1
    Thanks for your answer, but the documentation you linked to is not the issue that I'm having. The steps you show in workaround 2 are exactly what I have to do every time I need to disable USB wake on a device. What I want is for this wake to be disabled by default so I don't have to do these steps every time, and I could not found any way to do that at all... – Duke Nukem Aug 17 '13 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.