Wednesday, October 8, 2008

Status Check for Wake On Lan

On Error Resume Next

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

arrComputers = Array("ComputerName")
For Each strComputer In arrComputers
   WScript.Echo
   WScript.Echo "=========================================="
   WScript.Echo "Computer: " & strComputer
   WScript.Echo "=========================================="

   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\WMI")
   Set colItems = objWMIService.ExecQuery("SELECT * FROM MSNdis_DeviceWakeOnMagicPacketOnly", "WQL", _
                                          wbemFlagReturnImmediately + wbemFlagForwardOnly)

   For Each objItem In colItems
      WScript.Echo "Active: " & objItem.Active
      WScript.Echo "EnableWakeOnMagicPacketOnly: " & objItem.EnableWakeOnMagicPacketOnly
      WScript.Echo "InstanceName: " & objItem.InstanceName
      ''WScript.Echo   " **Computer" & strComputer & "  WOL Settings Failed to Retrive"
     
   Next
Next

No comments: