Disable “Allow the computer to turn off the device to save power” for all WiFi adapters

Written by Ingmar Verheij on May 1st, 2014. Posted in Other

When a Windows computer enters sleep mode it ensures that WiFi adapters enters the device power state D3 (Sleep) and on resume ensure it puts it back to the device power state D0 (Full on).

Windows assumes that if a driver says it supports sleep states it handles this correctly, but this setting is known to cause some spontaneous disconnects with the access point (AP). Optionally Windows can be configured to place the WiFi adapters in device power state D4 (Off).

I wrote a PowerShell script that disables the “Allow the computer to turn off this device to save power” setting for all WiFi adapters (contact me if you want it to disable ALL network adapters).

Allow the computer to turn off this device to save power

According to KB2740020 this setting changes the behavior of when power needs to be saved (for instance when a computers enters the S3 sleep mode), it does not mean Windows will turn of this device when it wants to save power. If you read the setting you could assume that Windows does turns off a device when it tries to reduce power consumption, in fact that’s what some people do experience.  It gets worse:

Setting Explanation
Enabled / Checked When the machine goes into sleep mode the device power state is changed from D0 to D3 (sleep).
Disabled / Unchecked When the machine goes into sleep mode the device power state is changed from D0 to D4 (off).

So when the setting allow the computer to turn off this device to save power is enabled it actually puts it to sleep, not turn off. The result is an inverse of what it says :-/

Allow the computer to turn off this device to save power

Strangely enough later on the same article explains that by setting a certain registry value (PnPCapabilities) to 24 it will prevent Windows from turning off the network adapter (and use Wake-on-LAN). Either way, I created the script and applied it.

 

PowerShell

So I wrote a PowerShell script that queries all available WiFi adapters and disables the Allow the computer to turn off the device to save power.

DisablePowerSavingForWLAN

Usage

The script runs without arguments but requires elevated privileges, this is enforced by the script.

 

Download

You can download the files here:  DisablePowerSavingForWLAN

 

.

Ingmar Verheij

At the time Ingmar wrote this article he worked for PepperByte as a Senior Consultant (up to May 2014). His work consisted of designing, migrating and troubleshooting Microsoft and Citrix infrastructures. He was working with technologies like Microsoft RDS, user environment management and (performance) monitoring. Ingmar is User Group leader of the Dutch Citrix User Group (DuCUG). RES Software named Ingmar RES Software Valued Professional in 2014.

More Posts - Website

Follow Me:
TwitterLinkedInGoogle Plus

Tags: , ,

Trackback from your site.

Comments (2)

  • Neil
    16 December 2014 at 14:57 |

    Hi there,

    I like your handy script, just wondering if you have a similar script that will do the same for the Lan NIC. I have clients that after sleep mode, lose there mapped drives. I relatively new to powershell. Any help would be great.

  • Jim
    8 February 2015 at 13:29 |

    I need a script which will leave the LAN Adapter Network Cards (NIC or other words Ethernet) in the D3 state and able to do Wake On LAN from the Complete Shutdown State (S5). If you need to do a higher Dx state such as D0 that is fine with me. I am using a Windows 8.1 Pro computer. I used to be able to do Wake On LAN but at some point (I believe when I went to Windows 8.1 that capability stopped working). I believe now when Windows does shutdown, Windows puts the LAN Adapters into complete power off state as I cannot not see any lights on the Network Controller Port/Connector. Thanks.

Leave a comment

*

Donate

%d bloggers like this: