Adding WMIC right-click actions to the ConfigMgr 2007 admin console (2)

September 29, 2009 at 1:32 pm in AdminUi, ConfigMgr, ConfigMgr 2007, sccm, SCCM 2007 by Kenny Buntinx [MVP]

Hi All,

 

In Post 1 of this topic we looked at the different WMI-command line actions you could trigger on a SCCM 2007 client.

In this post we’ll use that knowledge together with the knowledge of extending the admin console with custom actions series I did a couple of months ago to add these actions to our console.

Customize the sccm admin console – deep dive 1: http://scug.be/blogs/sccm/archive/2008/08/04/customize-the-sccm-2007-console-deep-dive-1.aspx

Customize the sccm admin console – deep dive 2: http://scug.be/blogs/sccm/archive/2008/08/04/customize-the-sccm-2007-console-deep-dive-2.aspx

Customize the sccm admin console – deep dive 3: http://scug.be/blogs/sccm/archive/2008/08/04/customize-the-sccm-2007-console-deep-dive-3.aspx

 

In the first post of the admin console deep dive session you learned how to create an xml to add custom actions. The example xml at that time looked like this.

Notepad Example Action XML

<ActionDescription Class="Executable" DisplayName="Make a Note" MnemonicDisplayName="Note" Description = "Make a note about software updates">
      <Executable>
           <FilePath>Notepad.exe</FilePath>
           <Parameters>C:\MyConfigurationManagerNote.txt</Parameters>
      </Executable>
</ActionDescription>

As you can see this example launched notepad as an executable. Given our new wmic commandlines we could replace that xml with the following to add a trigger hardware inventory action.

WMIC Action XML – Initial attempt

<ActionDescription Class="Executable" DisplayName="Trigger hardware inventory" MnemonicDisplayName="Trigger Hardware inventory" Description = "Trigger Hardware inventory">
      <Executable>
           <FilePath>WMIC</FilePath>
           <Parameters>/node:computername /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000001}"</Parameters>
      </Executable>
</ActionDescription>

 

Although this WMIC XML might look good at first glance, there is still a problem with passing the parameters, more specifically the section /node:Computername should have Computername replaced with the actual computername from the console where we intended to initiate this action. That’ is were the ##SUB## parameters come into play.

When you execute any action in the console, some specific paramaters are passed on in the following syntax: ##SUB:Parametername##, which parameters are available depends on the location you execute the action from in the ConfigMgr Admin console. For our purposes the most important thing is that the Name parameter is passed on when you click a resource in the details pane of a collection. With that knowledge, our WMIC Action XML should actually become:

 

<ActionDescription Class="Executable" DisplayName="Trigger hardware inventory" MnemonicDisplayName="Trigger Hardware inventory" Description = "Trigger Hardware inventory">
      <Executable>
           <FilePath>WMIC</FilePath>
           <Parameters>/node:##SUB:Name## /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000001}"</Parameters>
      </Executable>
</ActionDescription>

Note that the Computername has been replaced by ##SUB:Name## which will dynamically be resolved to the name of the resource you right-clicked on to launch the action.

 

Final step – Add the action to the console

To actually make the action appear in the console, we need to copy the above xml into  the folder with the right guid underneath:

Program Files\Microsoft Configuration Manager\AdminUI\XmlStorage\Extensions\Actions

For our specific purposes we want the action to appear when we right-click a computer system inside a collection, which corresponds to guid:

7ba8bf44-2344-4035-bdb4-16630291dcf6

So just create the folder Program Files\Microsoft Configuration Manager\AdminUI\XmlStorage\Extensions\Actions\7ba8bf44-2344-4035-bdb4-16630291dcf6 copy the WMIC xml inside the folder and restart the ConfigMgr Admin console.

Enjoy.

"Everyone is an expert at something"
Kim Oppalfens – Sms Expert for lack of any other expertise
Windows Server System MVP – SMS
http://www.scug.be/blogs/sccm/default.aspx

http://www.linkedin.com/in/kimoppalfens

Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInPin on Pinterest