JSI Tip 7999. How can I remotely enable, or disable, power management on a Windows XP network adapter, from the command-line?

Jerold Schulman

May 2, 2004

1 Min Read
ITPro Today logo in a gray background | ITPro Today

I have scripted NICSavePower.bat to enable, or disable, power management on a local, or remote, Windows XP computer's network adapter.

The syntax for using NICSavePower.bat is:

NICSavePower ComputerName NIC On|Off

Where ComputerName is the NetBIOS name of the local or remote computer, NIC is any unique portions of the network adapter's driver description, without any special command control characters, like ( ) &, and On|Off is On to enable power management, and Off will disable power management.

Example:

To disable power management on the gigabit ethernet adapter of a local computer (JSI009), whose network adapter's driver description's are Intel(R) PRO/1000 MTW Network Connection and Intel(R) PRO/Wireless LAN 2100 3A Mini PCI Adapter, you could use any of the following:

NICSavePower %ComputerName% 1000 offNICSavePower %ComputerName% "NTW Network" offNICSavePower %ComputerName% "ntw network" offNICSavePower  jsi009 "1000" offNICSavePower  jsi009 "0 M" off

NICSavePower.bat contains:

@echo offif /i {%3}
<h1><a name="_on_goto_start_if_i_3_" id="_on_goto_start_if_i_3_">{on} goto startif /i {%3}</a></h1>
{off} goto start@echo Syntax: NICSavePower ComputerName NIC On^|Offgoto :EOF:startsetlocal ENABLEDELAYEDEXPANSIONset computer=%1set NIC=%2set NIC="%NIC:"=%"set ONOFF=%3set data=56if /i "%ONOFF%" EQU "on" set data=48set qry=reg query "\%computer%HKLMSYSTEMCurrentControlSetControlClass\{4D36E972-E325-11CE-BFC1-08002bE10318}" /sfor /f "Tokens=*" %%p in ('%qry%') do ( set line=%%p set line=!line:^&=! set line=!line:^)=! set line=!line:^(=! set line=!line:^=! call :parse)endlocalgoto :EOF:parseif /i "%line:~0,5%" NEQ "HKEY_" goto parse1set key=%line%set key=%key:HKEY_LOCAL_MACHINE=HKLM%goto :EOF:parse1call :parse2>nul 2>&1goto :EOF:parse2for /f "Tokens=*" %%f in ('@echo %line%^|findstr /i /c:%NIC% ^|findstr /i /c:"DriverDesc"') do (  if defined key reg add "\%computer%%key%" /v PnPCapabilities /t REG_DWORD /d %data% /f&set key=)



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like