Hi,
Just wondering if anyone has a script which enables in Power management of NIC cards:
Allow the computer to turn off this device to save power
Allow this device to bring the computer out of standby
But deselect
Only allow management stations to bring the computer out of standby
NIC Power Management
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
NIC Power Management
Hi,
Ive tried this script but couldnt get it to work. It works fine if you dont edit it, but if you try and change it so that it looks like below it runs but doesnt change anything:
'************************************************************************
'* VBS Script to:
'* Enable/Disable showing the icon in your system tray for connected NICs
'* Enable/Disable Power Management for Connected NICs
'************************************************************************
'Let's setup our variables
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE info for registry writes
Dim objReg 'Registry Object
Dim objWMIService 'WMI Service Object
Dim arrayNetCards 'Array of all connected NICs
Dim objNetCard 'A specific NIC
Dim strNICguid '
Dim strShowNicKeyName 'Key Specific to the Network Adapters in CurrentControlSet
Dim strShowNicKeyName001 'Key Specific to the Network Adapters in CurrentControlSet001
Dim strPnPCapabilitesKeyName 'Key Specific to the Network Adapters in CurrentControlSet
Dim strPnPCapabilitesKeyName001 'Key Specific to the Network Adapters in CurrentControlSet001
Dim strComputer 'Name of computer to modify
strComputer = "." 'Period = local computer
strShowNicKeyName = "SYSTEMCurrentControlSetControlNetwork{4D36E972-E325-11CE-BFC1-08002BE10318}"
strShowNicKeyName001 = "SYSTEMCurrentControlSet001ControlNetwork{4D36E972-E325-11CE-BFC1-08002BE10318}"
strPnPCapabilitiesKeyName = "SYSTEMCurrentControlSetControlClass{4D36E972-E325-11CE-BFC1-08002bE10318}"
strPnPCapabilitiesKeyName001 = "SYSTEMCurrentControlSet001ControlClass{4D36E972-E325-11CE-BFC1-08002bE10318}"
ShowNicdwValue = 1 '1 for ON, 0 for OFF
PnPdwValue = 32 '56 to disable "Allow the computer to turn off this device to save power."
'48 to enable "Allow the computer to turn off this device to save power."
'32 to enable "Allow the computer to turn off this device to save power."
' and enable "Allow this device to bring the computer out of standby."
'288 to enable "Allow the computer to turn off this device to save power."
' and enable "Allow this device to bring the computer out of standby."
' and enable "Only allow management stations to bring the computer out of standby."
On Error Resume Next
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!" & strComputer & "rootdefault:StdRegProv")
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!" & strComputer & "rootcimv2")
'Look for the NICs that have IP enabled
Set arrayNetCards = objWMIService.ExecQuery ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
'Make changes on the NICs that have IP enabled
For Each objNetCard in arrayNetCards
strNICguid = objNetCard.SettingID 'Get the GUID of the NIC
strDeviceID = Mid(objNetCard.Caption,6,4) 'Get the DeviceID of the NIC
'Change the "Show icon in notification area when connected value"
objReg.SetDWORDValue HKLM, strShowNicKeyName & strNICguid & "Connection", "ShowIcon", ShowNicdwValue
objReg.SetDWORDValue HKLM, strShowNicKeyName001 & strNICguid & "Connection", "ShowIcon", ShowNicdwValue
'Change the Power Management Values
objReg.SetDWORDValue HKLM, strPnPCapabilitiesKeyName & strDeviceID & "","PnPCapabilities",PnPdwValue
objReg.SetDWORDValue HKLM, strPnPCapabilitiesKeyName001 & strDeviceID & "","PnPCapabilities",PnPdwValue
Next
Set objReg = Nothing
Set objWMIService = Nothing
Ive tried this script but couldnt get it to work. It works fine if you dont edit it, but if you try and change it so that it looks like below it runs but doesnt change anything:
'************************************************************************
'* VBS Script to:
'* Enable/Disable showing the icon in your system tray for connected NICs
'* Enable/Disable Power Management for Connected NICs
'************************************************************************
'Let's setup our variables
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE info for registry writes
Dim objReg 'Registry Object
Dim objWMIService 'WMI Service Object
Dim arrayNetCards 'Array of all connected NICs
Dim objNetCard 'A specific NIC
Dim strNICguid '
Dim strShowNicKeyName 'Key Specific to the Network Adapters in CurrentControlSet
Dim strShowNicKeyName001 'Key Specific to the Network Adapters in CurrentControlSet001
Dim strPnPCapabilitesKeyName 'Key Specific to the Network Adapters in CurrentControlSet
Dim strPnPCapabilitesKeyName001 'Key Specific to the Network Adapters in CurrentControlSet001
Dim strComputer 'Name of computer to modify
strComputer = "." 'Period = local computer
strShowNicKeyName = "SYSTEMCurrentControlSetControlNetwork{4D36E972-E325-11CE-BFC1-08002BE10318}"
strShowNicKeyName001 = "SYSTEMCurrentControlSet001ControlNetwork{4D36E972-E325-11CE-BFC1-08002BE10318}"
strPnPCapabilitiesKeyName = "SYSTEMCurrentControlSetControlClass{4D36E972-E325-11CE-BFC1-08002bE10318}"
strPnPCapabilitiesKeyName001 = "SYSTEMCurrentControlSet001ControlClass{4D36E972-E325-11CE-BFC1-08002bE10318}"
ShowNicdwValue = 1 '1 for ON, 0 for OFF
PnPdwValue = 32 '56 to disable "Allow the computer to turn off this device to save power."
'48 to enable "Allow the computer to turn off this device to save power."
'32 to enable "Allow the computer to turn off this device to save power."
' and enable "Allow this device to bring the computer out of standby."
'288 to enable "Allow the computer to turn off this device to save power."
' and enable "Allow this device to bring the computer out of standby."
' and enable "Only allow management stations to bring the computer out of standby."
On Error Resume Next
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!" & strComputer & "rootdefault:StdRegProv")
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!" & strComputer & "rootcimv2")
'Look for the NICs that have IP enabled
Set arrayNetCards = objWMIService.ExecQuery ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
'Make changes on the NICs that have IP enabled
For Each objNetCard in arrayNetCards
strNICguid = objNetCard.SettingID 'Get the GUID of the NIC
strDeviceID = Mid(objNetCard.Caption,6,4) 'Get the DeviceID of the NIC
'Change the "Show icon in notification area when connected value"
objReg.SetDWORDValue HKLM, strShowNicKeyName & strNICguid & "Connection", "ShowIcon", ShowNicdwValue
objReg.SetDWORDValue HKLM, strShowNicKeyName001 & strNICguid & "Connection", "ShowIcon", ShowNicdwValue
'Change the Power Management Values
objReg.SetDWORDValue HKLM, strPnPCapabilitiesKeyName & strDeviceID & "","PnPCapabilities",PnPdwValue
objReg.SetDWORDValue HKLM, strPnPCapabilitiesKeyName001 & strDeviceID & "","PnPCapabilities",PnPdwValue
Next
Set objReg = Nothing
Set objWMIService = Nothing
NIC Power Management
Are you saying that it runs wih no errors eeven after removing the On Error line?
Are you sure the adapter can use power management.
These setting changes will require a restart to function.
Are you sure the adapter can use power management.
These setting changes will require a restart to function.
NIC Power Management
Well it is clear that the code cannot work becuse it was never written correctly.
What the user is trying to do will only work on one specific machine which has only one setting. Most machines will have multiple entries for the network GUID.
jvierra2012-02-22 12:29:28
What the user is trying to do will only work on one specific machine which has only one setting. Most machines will have multiple entries for the network GUID.
jvierra2012-02-22 12:29:28
NIC Power Management
Sorry for the late response. Thanks for that, works perfectly. Just wondering if there's a way to add this into a script/batch file where powercfg /DEVICEQUERY wake_programmable brings back the list, and then from that list picks out all broadcom adapters. It then adds that into the "compliant device id". I've managed to create a batch file which sends the first bit of the info to a text file. Just looking for a way of scanning the text file finding the info and putting into either a script or batch file with powercfg /DEVICEENABLEWAKE.