Script to disable "turn off this device to save power" for NIC Power Management (PowerShell)


This PowerShell Script illustrates how to disable "turn off this device to save power" feature in Power Management.


Many users want to disable the option in network device called: The computer turn off this device to save power. Now, this script can help users to disable "turn off this device to save power" feature in Power Management of all physical network adapters.


Step 1: Click Start, type powershell in the search box on the Start Menu, right-click the Windows PowerShell icon, and then click Run Windows PowerShell as administrator. If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Continue.

Step 2: Run the script in the Windows PowerShell Console, type the command: <Script Path> at the prompt.

For example, type D:\Script\DisableNetworkAdapterPnPCapabilities.ps1

This is shown in the following figure.

Step 3: Finally, when the script finishes running, it will return a brief message in the current Windows PowerShell Console. And you will see this option has been disabled as expected.

Here are some code snippets for your references. To get the complete script sample, please click the download button at the beginning of this page.

If($PnPCapabilitiesValue -eq 0{ 
    #check whether change value was successed. 
        #setting the value of properties of PnPCapabilites to 24, it will disable save power option. 
        Set-ItemProperty -Path $KeyPath -Name "PnPCapabilities" -Value 24 | Out-Null 
        Write-Host """$PhysicalAdapterName"" - The option ""Allow the computer to turn off this device to save power"" was disabled." 
        Write-Warning "It will take effect after reboot, do you want to reboot right now?" 
        [string]$Reboot = Read-Host -Prompt "[Y] Yes  [N] No   (default is 'N')" 
        If ($Reboot -eq "y" -or $Reboot -eq "yes")  
            Restart-Computer -Force 
        Write-Host "Setting the value of properties of PnpCapabilities failed." -ForegroundColor Red 



Windows PowerShell 2.0 

Related forum threads: