CM 2012 Wake on LAN – Right click tools

January 4, 2013

Hi,

First of all our best wishes for the new year.

Today was my first day back after almost 2 weeks off and I immediately had something interesting at my customer.

They wanted to use the Wake On LAN feature of Configuration Manager 2012, that’s why I have installed the right click tools for the Configuration Manager 2012 Console. More information about the right click tools can be found here: http://bscexp.blogspot.be/2012/05/sccm-2012-right-click-tools.html

Installing the right click tools didn’t work because Configuration Manager 2012 is installed on the D: partition, so I manually copied all folders in the right place

After copying the right click tools new options are available for every computer. The option I’m interested in at the moment is Wake On LAN (marked in yellow on the following screenshot)

 04012013_SCCM2012_1

When this option is clicked a messagebox appears which states that sending the WakeUp to the specific computer succeeded, but if I look at the computer doesn’t wake up at all.

04012013_SCCM2012_2

When using the Wake On LAN feature of Altiris Deployment Server for example the Wake On LAN did succeed. So I started to examine the differences between both. After using some network tracing tools like WireShark I saw that the Wake On LAN functionality provided by the right click tools for Configuration Manager 2012 did a broadcast to 255.255.255.255 and the Wake On LAN from Altiris performed a broadcast to the broadcastaddress of the VLAN where the client was located (eg. 10.16.92.255). After some more digging in I found out that the switches dropped all traffic with destination 255.255.255.255.

So what I needed to do was editing the Wake On LAN functionality of the right click tools to make sure the VLAN broadcast address was targeted, now I will describe how I did that.

First I looked at the console extension XML to see what commandline was started when I clicked Wake On LAN from the Configuration Manager 2012 console. The XML is located in the installation directory of Configuration Manager: D:\Program Files\Microsoft Configuration Manager\AdminConsole\XmlStorage\Extensions\Actions\ed9dee86-eadd-4ac8-82a1-7234a4646e62.

<ActionDescription Class=”Executable” DisplayName=”Wake On LAN” MnemonicDisplayName=”Wake On LAN” Description=”Send Wake on LAN signal to system”>

<ShowOn>

<string>ContextMenu</string>

</ShowOn>

  <Executable>

          <FilePath>wscript.exe</FilePath>

          <Parameters> “C:\Program Files\SCCMConsoleExtensions\SCCMAction.vbs” ##SUB:Name## W ##SUB:ResourceID## ##SUB:__Server## ##SUB:__Namespace##</Parameters>

        </Executable>

      </ActionDescription>

The area marked in boldshows what script is started when Wake On LAN is clicked, so I’ve opened this script.

 Sub WakeOnLAN

    On Error Resume Next

     Set objSMSWMIService = GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” & strSiteServer & “\” & strNameSpace)

    Set colMACAddress = objSMSWMIService.ExecQuery(“SELECT * FROM SMS_G_System_NETWORK_ADAPTER_CONFIGURATION WHERE ResourceID='” & strResourceID & “‘ AND IPAddress IS NOT NULL”)

    For Each instance in colMACAddress

        strMACAddress = instance.MACAddress

        strWOLAddress = (Replace(instance.MACAddress,”:”,””))

         WshShell.Run chr(34) & strCurrentPath & “WOL.exe” & chr(34) & ” ” & strWOLAddress,0

        strWOLSent = strWOLSent & vbCrLf & strMACAddress

    Next

     ResultMsg = MsgBox(“Wakeup sent to the following MACs for ” & strComputer & vbCrLf & strWOLSent,64,strVersion)

    WScript.Quit

End Sub

It is clear that the WOL.exe is started with the parameter strWOLAddress (which is the Macaddress without colons (:)).

WOL.exe doesn’t support entering the VLAN broadcastaddress so I searched for another exe-file that was able to do that. I found an alternative mc-wol.exe which was able to handle the broadcastaddress. More information about mc-wol.exe: http://www.matcode.com/wol.htm

First of all I copied mc-wol.exe to the folder C:\Program Files\SCCMConsoleExtensions where all the rest of the scripts, exe-files,… are located. This will make sure the new exe can be used from the Configuration Manager console.

Next thing to do was getting the subnet from the specific resource from Configuration Manager. That was rather easy because the Wake On LAN sub in SCCMAction.vbs contains the functionality to retrieve information from Configuration Manager. Just adding the intelligence to retrieve the IP address did the trick. Afterwards splitting the IP address and replacing the last part with 255 (eg. IP: 10.16.92.56 –> 10.16.92.255).

Final thing to do is building up the new commandline using mc-wol.exe instead of the default wol.exe.

 

Sub WakeOnLAN

    On Error Resume Next

     Set objSMSWMIService = GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” & strSiteServer & “\” & strNameSpace)

    Set colMACAddress = objSMSWMIService.ExecQuery(“SELECT * FROM SMS_G_System_NETWORK_ADAPTER_CONFIGURATION WHERE ResourceID='” & strResourceID & “‘ AND IPAddress IS NOT NULL”)

    For Each instance in colMACAddress

        strMACAddress = instance.MACAddress

strIPAddress = instance.IPAddress(0)

strIPSplit = split (strIPAddress,”.”)

strIP = strIPSplit(0) & “.” & strIPSplit(1) & “.” & strIPSplit(2) & “.255”

       WshShell.Run chr(34) & strCurrentPath & “mc-wol.exe” & chr(34) & ” ” & strMACAddress & ” /a ” & strIP

        strWOLSent = strWOLSent & vbCrLf & strMACAddress

    Next

     ResultMsg = MsgBox(“Wakeup sent to the following MACs for ” & strComputer & vbCrLf & strWOLSent,64,strVersion)

    WScript.Quit

End Sub

 

Save the new SCCMAction.vbs and try again.

Now the VLAN broadcast address will be targeted and the computer will be able to perform Wake On LAN.

Hope this helps.

Cheers,

B

Advertisements

Authenticate SCOM console on a proxy

September 27, 2012

When going to client environments I often face this issue: internet access is only possible when authenticating against a proxy. Now, this is especially a problem when you want to be able to download management packs using the SCOM console, or at least check whether you are up-to-date.

Following a hint of my collegue Thomas Vuylsteke (see his excellent blog at http://setspn.blogspot.com/), I quickly found the “proxy configuration” page on MSDN, stating that it is possible to configure proxy utilization in the .exe.config file: http://msdn.microsoft.com/en-us/library/dkwyc043.aspx

This is actually a quick fix:

On SCOM 2012, open C:\Program Files\System Center 2012\Operations Manager\Console\Microsoft.EnterpriseManagement.Monitoring.Console.exe.config

Add the following code:

<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy usesystemdefault="True" />
</defaultProxy>
</system.net>

The bottom of your config-file should look like this:


En now it is possible to use the online catalog!



A quick fix for a nasty issue! I didn’t test it yet for the SCOM 2007 R2 console, but I’m pretty sure it will also work for that version.

UPDATE: apparently, the quotes didn’t pass very well in this blog post. I updated it so now you should be able to copy-paste the code.

UPDATE2: I confirmed that this works with non-MS proxy servers.