Hey folks!
I need some pointers / guidance / solutions / anything, this WOL thing is really bustin my n*ts.
In an attempt to get on the 'Green IT' bandwagon, I'm looking at the possibility of shutting machines down every evening and waking them early in the morning, ready for use. I spent 3 days auditing the networking hardware across the domain, considering what NICs are WOL capable and which aren't. So, the ones that are WOL capable, are sorted in the BIOS. However, I find that the there is a particular setting in the Advanced Settings tab of the device properties that is really ruining my day. I tried the following script (which I picked up from another post here), to use WMI to 'theoretically' enable the settings that Power Management needs to get things moving....
However, after much local and remote testing, the script doesn't do anything to enable WOL. I have narrowed it down to one or two settings on the Advanced Settings tab of the device properties.Code:Option Explicit Dim colNetworkAdapters Dim objNetworkAdapter Dim strDevInstanceName Dim strNetworkAdapterID 'Query for all of the Win32_NetworkAdapters that are wired Ethernet (AdapterTypeId=0 corresponds to Ethernet 802.3) Set colNetworkAdapters = GetObject("WinMgmts:{impersonationLevel=impersonate, (LoadDriver)}//./root/Cimv2")_ .ExecQuery("SELECT * FROM Win32_NetworkAdapter WHERE AdapterTypeId=0") WScript.Echo "Enabling WoL for the following adapters:" For Each objNetworkAdapter In colNetworkAdapters WScript.Echo " " & objNetworkAdapter.Name & " [" & objNetworkAdapter.MACAddress & "]" strNetworkAdapterID = UCase(objNetworkAdapter.PNPDeviceID) 'Query for all of the MSPower_DeviceWakeEnable classes Dim colPowerWakeEnables Dim objPowerWakeEnable Set colPowerWakeEnables = GetObject("WinMgmts:{impersonationLevel=impersonate, (LoadDriver)}//./root/wmi")_ .ExecQuery("SELECT * FROM MSPower_DeviceWakeEnable") 'Compare the PNP Device ID from the network adapter against the MSPower_DeviceEnabled instances For Each objPowerWakeEnable In colPowerWakeEnables 'We have to compare the leftmost part as MSPower_DeviceEnabled.InstanceName contains an instance suffix strDevInstanceName = UCase(Left(objPowerWakeEnable.InstanceName, Len(strNetworkAdapterID))) 'Match found, enable WOL If StrComp(strDevInstanceName, strNetworkAdapterID)=0 Then objPowerWakeEnable.Enable = True objPowerWakeEnable.Put_ 'Required to write the value back to the object WScript.Echo "Found MSPower Class...Wake enable set." End If Next 'Query for all of the MSNdis_DeviceWakeOnMagicPacketOnly classes Dim colMagicPacketOnlys Dim objMagicPacketOnly Set colMagicPacketOnlys = GetObject("WinMgmts:{impersonationLevel=impersonate, (LoadDriver)}//./root/wmi")_ .ExecQuery("SELECT * FROM MSNdis_DeviceWakeOnMagicPacketOnly") 'Compare the PNP Device ID from the network adapter against the MSNdis_DeviceWakeOnMagicPacketOnly instances For Each objMagicPacketOnly In colMagicPacketOnlys 'We have to compare the leftmost part as MSNdis_DeviceWakeOnMagicPacketOnly.InstanceName contains an instance suffix strDevInstanceName = UCase(Left(objMagicPacketOnly.InstanceName, Len(strNetworkAdapterID))) 'Match found, enable WOL for Magic Packets only If StrComp(strDevInstanceName, strNetworkAdapterID)=0 Then objMagicPacketOnly.EnableWakeOnMagicPacketOnly = True 'Set to false if you wish to wake on magic packets AND wake patterns objMagicPacketOnly.Put_ 'Required to write the value back to the object WScript.Echo "Found Magic Packet Class...Wake enable set." End If Next Next
advNICproperties.jpg
The problem is, this setting needs applied across 100 or so machines (in addition to any new machines that are rebuilt/imaged). Can anyone advise me on how to change this setting programatically, across the domain?
Any help, ideas, anything! as always, very much appreciated.


LinkBack URL
About LinkBacks


