Link to home
Start Free TrialLog in
Avatar of lulz
lulz

asked on

GPO Setting/Script to enable USB keyboard/mice to wake computer from standby

I am trying to find some information on how to set any USB mouse and keyboard to "Allow device to wake computer from standby."

I search EE and found most questions/answers were from 2009 or before.  This is 2011- there has got to be a way to get this to work without having to physically touch each machine.  I used procmon to find the registry entry for a few keyboards and a few mice, but every device has a different registry entry.

Only found XP to not have these checked by default.  On Windows 7 every USB HID device I tried on multiple workstations had this enabled by default.


Any help is much appreciated.
Avatar of pjasnos
pjasnos
Flag of United Kingdom of Great Britain and Northern Ireland image

Just to be more precise - are you trying to enable this setting on Win XP, or disable it on Win 7?
SOLUTION
Avatar of pjasnos
pjasnos
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lulz
lulz

ASKER

I need it enabled on every WinXP machine.  We are moving to Win7, but the request was made to enable it on all existing WinXP machines.

We initially made a powercfg bat file that just loops through every device that is capable of waking the machine and enables it.  It just seems sloppy to do it that way.  A script that could detect mice/keyboards and enable would be preferred.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lulz

ASKER

I started making a batch file (see below) but it doesn't store information into the text file correctly.  When I type the command in the prompt it works, but in the batch it doesn't.  Also don't know how to pull the information out of the file and enable the devices line by line until EOF.

I'm grasping at straws to get this running.  VBScript is still preferred but I'm very unfamiliar in it.


powercfg -DEVICEQUERY wake_programmable > C:\%COMPUTERNAME%.txt
findstr /i "mouse" C:\%COMPUTERNAME%.txt > C:\%COMPUTERNAME%_PWR.txt
findstr /i "keyboard" C:\%COMPUTERNAME%.txt >> C:\%COMPUTERNAME%_PWR.txt

powercfg -DEVICEENABLEWAKE ???

Open in new window

Avatar of lulz

ASKER

Latest solution that works, but doesn't record results correctly in the log file.  Any assistance with this?

@ECHO OFF

(
echo keyboard
echo mouse
) > "C:\devices.txt"

if exist "%temp%\results.log" del "%temp%\results.log"

for /F "delims=" %%f in ('powercfg.exe /DEVICEQUERY wake_programmable ^| findstr /g:"C:\devices.txt" /i ') do ( powercfg.exe /DEVICEENABLEWAKE "%%f" >> "%temp%\results.log" )

if exist C:\devices.txt del C:\devices.txt

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lulz

ASKER

The solution will enable any attached mouse or keyboard to wake a computer from standby.  This script can be set as a login script.