Issue

In order to use ZCM Wake On LAN or ENGL Zwake it may be necessary to enable the Wake On LAN functionality of the NIC within the installed operating system.

Solutions

NOTE: ENGL makes no warranty about the suitability of these scripts or guidance for your environment, nor are they officially supported by ENGL in any way. They are provided for demonstration purposes only and should be tested in a non-production environment.


  1. Deploy a registry file in the drivers add-on image
    It is possible to control the Wake on LAN capabilities of the network cards by using registry keys, however these keys are dynamic and will generally be different for different machine types / NICs so a custom registry file must be deployed per workstation type, i.e., in the drivers add-on image.

    A sample registry fragment is reproduced below;

    REGEDIT4
    
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0005]
    
    "PnPCapabilities"=dword:00000020
    
    [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0005]
    
    "PnPCapabilities"=dword:00000020
  2. Use a script to enumerate through all wired adapters and enable Wake on LAN. 

    A much easier option is to deploy a script which enumerates all wired network adapters and enables the Wake on LAN capabilities. This script may be used on all machines and can therefore be delivered by the common build (ztoolkit.zmg) add-on image.

     A sample script is reproduced below;

    ' ENGL Imaging Toolkit Build Console
    ' Copyright (C) 1999-2010 Expert Networking Group Limited
    ' WOL enable
    '
    '
    ' Custom script template (phase1-before.vbs)
    
    
    ' Attach to ENGL Ztoolkit ActiveX Control
    Set LDAP = CreateObject("ENGL.Ztoolkit.LDAP")
    Set Utils = CreateObject("ENGL.Ztoolkit.Utils")
    Set ZENworks = CreateObject("ENGL.Ztoolkit.ZENworks")
    set WSHshell = createobject("wscript.shell")
    
    
    '
    ' Enable Wake-on-LAN on all wired network cards
    '
    
    Utils.AppendLog "enable WoL for all wired Ethernet adapters"
    
    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}//./root/Cimv2").ExecQuery("SELECT * FROM Win32_NetworkAdapter WHERE AdapterTypeId=0")
    
    Utils.AppendLog "Enabling WoL:"
    
    For Each objNetworkAdapter In colNetworkAdapters
    
        Utils.AppendLog "  " & 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}//./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)))
    
            If StrComp(strDevInstanceName, strNetworkAdapterID)=0 Then'Match found, enable WOL
                utils.appendLog "     WoL enabled"
                objPowerWakeEnable.Enable = True
                objPowerWakeEnable.Put_'Required to write the value back to the object
            End If
        Next
    
        'Query for all of the MSNdis_DeviceWakeOnMagicPacketOnly classes
        Dim colMagicPacketOnlys
        Dim objMagicPacketOnly
        Set colMagicPacketOnlys = GetObject("WinMgmts:{impersonationLevel=impersonate}//./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)))
    
            If StrComp(strDevInstanceName, strNetworkAdapterID)=0 Then'Match found, enable WOL for Magic Packets only
                utils.appendLog "     Magic Packet only enabled"
                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
            End If
        Next
    
    Next
    
    Utils.AppendLog "WoL reconfiguration completed"