How to enable the "Allow device to wake up computer" software feature?

On some computers, network adapters are configured by default with the "Allow this device to swell the computer" option turned off. As a result, Wake on LAN will not work.

I need to enable this option again, but I cannot do it manually - there are too many computers! Therefore, I need to be able to do this through the API or using a script.

(Note: this is not a duplicate of activating Wake On LAN programmatically , since this issue is about setting up the BIOS, while it is about setting up the operating system.)

I have an answer already using the script package, but alternative solutions would be very welcome, especially if they use the API.

+6
source share
1 answer

I found a solution on The Old New Thing . The powercfg command allows you to manage power settings, and in particular, you can use -deviceenablewake and -devicedisablewake to enable or disable the "Allow this device to wake up the computer" option.

You can see which devices are capable of doing this with this command:

 powercfg -devicequery wake_from_any 

You can see which devices are currently available using:

 powercfg -devicequery wake_armed 

Combining all this, this is a script package that I just started using to enable Wake on LAN:

 powercfg -devicequery wake_from_any | findstr /i "network ethernet" >adapters.txt for /F "tokens=*" %%i in (adapters.txt) do powercfg -deviceenablewake "%%i" powercfg -devicequery wake_armed | findstr /i "network ethernet" || goto :failed 

In this case, I decided to enable this option on all valid devices whose name contains the word "network" or the word "ethernet"; in some situations, of course, you may prefer to select which devices you have turned on more selectively.

+11
source

Source: https://habr.com/ru/post/921808/


All Articles