Hi everyone,
I need to configure the power management on the NIC. I need to disable "Allow the computer to turn off this device to save power"
I have this script, but when I run i get "Broadcom NetXtreme 57xx Gigabit Controller
Device Number is: 0001
D:\Script\Sample Scripts\Change NIC PM.vbs(21, 2) SWbemObjectEx: Type mismatch
I'm desperately need help to get going with this. Could you help me figure out what's wrong? Thank you so much.
Const HKEY_LOCAL_MACHINE = &H80000002
' On Error Resume Next
strComputer = "."
strKeyPath = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\"
strValueName = "PnPCapabilities"
dwValue = "294"
Set StdOut = WScript.StdOut
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set arrayNetCards = GetObject("WinMgmts:{impersonationLevel=impersonate}//./root/Cimv2")_
.ExecQuery("SELECT * FROM Win32_NetworkAdapter WHERE AdapterTypeId=0")
For Each objNetCard In arrayNetCards
WScript.Echo objNetCard.name
' strDeviceID = UCase(objNetCard.PNPDeviceID)
strDeviceID = Mid(objNetCard.Caption,6,4) 'Get the DeviceID of the NIC
WScript.Echo "Device Number is: " & strDeviceID
'Change the Power Management Values
objReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strDeviceID,strValueName,dwValue
wscript.echo "HKEY_LOCAL_MACHINE\" & strkeyPath & vbNewLine & "Contains: " & dwValue
Next
Set objReg = Nothing
Set objWMIService = Nothing
I need to configure the power management on the NIC. I need to disable "Allow the computer to turn off this device to save power"
I have this script, but when I run i get "Broadcom NetXtreme 57xx Gigabit Controller
Device Number is: 0001
D:\Script\Sample Scripts\Change NIC PM.vbs(21, 2) SWbemObjectEx: Type mismatch
I'm desperately need help to get going with this. Could you help me figure out what's wrong? Thank you so much.
Const HKEY_LOCAL_MACHINE = &H80000002
' On Error Resume Next
strComputer = "."
strKeyPath = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\"
strValueName = "PnPCapabilities"
dwValue = "294"
Set StdOut = WScript.StdOut
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set arrayNetCards = GetObject("WinMgmts:{impersonationLevel=impersonate}//./root/Cimv2")_
.ExecQuery("SELECT * FROM Win32_NetworkAdapter WHERE AdapterTypeId=0")
For Each objNetCard In arrayNetCards
WScript.Echo objNetCard.name
' strDeviceID = UCase(objNetCard.PNPDeviceID)
strDeviceID = Mid(objNetCard.Caption,6,4) 'Get the DeviceID of the NIC
WScript.Echo "Device Number is: " & strDeviceID
'Change the Power Management Values
objReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strDeviceID,strValueName,dwValue
wscript.echo "HKEY_LOCAL_MACHINE\" & strkeyPath & vbNewLine & "Contains: " & dwValue
Next
Set objReg = Nothing
Set objWMIService = Nothing