Adding Icons to Views, Tasks and other Management Pack Items

There are a number of blog posts that are out there that explain how to add you own custom icons to Task, Folder, View etc. via editing the management pack in XML but I have not seen one that explains how to add an existing SCSM default icon from an existing management pack.

Below is my run down of how to add a nice icon to a task that appear on Incident work items.

The thing to first realise is that if you create a new task from the console there is NO WAY to add an icon to your new task. The GUI just does not let you select an icon. So to add it you must edit the XML in its raw state. This is not as hard as it sounds and if you focus on the specific items you need and ignore the rest, it is hard to go wrong.

In this example we have a task called “Ping Task” that simply runs Ping.exe (Yes, I know there is one there by default. But this is not about creating a task, this is just about the icon)

1) Firstly, you will need to create the task or tasks you wish to add icons for. This blog post will not cover how to add tasks, However it is important to know that any task you wish to edit the icon for will be stored in a Management Pack and if you wish to change the icon for each Task then you will have to edit each Management Pack.
In this case, I have only one task that I have added.

2) Once you have your task created, export the Management Pack that you created it in. This will save the Management pack to an XML file.

If you open the XML file you will see it looks like the following code:

<?xml version=”1.0″?>
<ManagementPack xmlns:xsl=”http://www.w3.org/1999/XSL/Transform&#8221;
xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; OriginalSchemaVersion=”1.1″ SchemaVersion=”2.0″ ContentReadable=”true”>

<Manifest>
  <Identity>
    <ID>ManagementPack.b0dceaceb44941fdb7905a1c110e58d9</ID>
    <Version>7.5.3079.0</Version>
  </Identity>

  <Name>TestTasks</Name>
  <References>
    <Reference Alias=”EnterpriseManagement”>
      <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Console</ID>
      <Version>7.5.3079.0</Version>
      <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
    </Reference>

    <Reference Alias=”WorkItem”>
      <ID>System.WorkItem.Incident.Library</ID>
      <Version>7.5.3079.0</Version>
      <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
    </Reference>

    <Reference Alias=”Administration”>
      <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Administration</ID>
      <Version>7.5.3079.0</Version>
      <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
    </Reference>
  </References>
</Manifest>

<Categories> 
<Category Value=
“EnterpriseManagement!Microsoft.EnterpriseManagement.ServiceManager.ManagementPack” ID=”Category.41440dd90b3f4d63b6a7c6c8ed70ae0b”>

    <ManagementPackName>ManagementPack.b0dceaceb44941fdb7905a1c110e58d9</ManagementPackName>
    <ManagementPackVersion>7.5.3079.0</ManagementPackVersion>
  </Category>
</Categories>

<Presentation>
  <ConsoleTasks>
    <ConsoleTask ID=”ConsoleTask.b2b1ee5abd5841a790d8f783e09d93a0″ RequireOutput=”true” Target=”WorkItem!System.WorkItem.Incident” Enabled=”true” Accessibility=”Public”>
      <Assembly>EnterpriseManagement!SdkDataAccessAssembly</Assembly>
      <Handler>Microsoft.EnterpriseManagement.UI.SdkDataAccess.CommandLineHandler</Handler>
      <Parameters>
        <Argument Name=”LoggingEnabled”>True</Argument>
        <Argument Name=”Application”>c:\windows\system32\ping.exe</Argument>
        <Argument Name=”WorkingDirectory”>%windir%\system32</Argument>
        <Argument Name=””/>
      </Parameters>
    </ConsoleTask>
  </ConsoleTasks>

<ImageReferences>
<ImageReference ImageID =
“Administration!Microsoft.EnterpriseManagement.ServiceManager.UI.Administration.Image.Security” ElementID=”ConsoleTask.b2b1ee5abd5841a790d8f783e09d93a0″/>

  </ImageReferences>
</Presentation>

<LanguagePacks>
  <LanguagePack ID=”ENU” IsDefault=”false”>
    <DisplayStrings>
      <DisplayString ElementID=”ManagementPack.b0dceaceb44941fdb7905a1c110e58d9″>
        <Name>TestTasks</Name>
        <Description/>
      </DisplayString>
      <DisplayString ElementID=”ConsoleTask.b2b1ee5abd5841a790d8f783e09d93a0″> 
        <Name>Ping Task</Name> 
        <Description/> 
      </DisplayString> 
    </DisplayStrings> 
  </LanguagePack> 
</LanguagePacks>
</ManagementPack>

Now, don’t get bogged down in what each of the elements mean. We are just worried about adding an icon at this stage.

The first thing we need to do with the XML code is to ensure we have a reference to the existing SEALED Management Pack that contains the image we are wanting to use. How do we know what images are in what Management pack? Good question.
Check out Anton Gritsenko’s blog that lists each of the management packs and their associated images.
http://blog.scsmsolutions.com/2012/04/list-of-images-available-in-scsm-2012/
I chose this image: 
clip_image001
Its file name is:
Microsoft.EnterpriseManagement.ServiceManager.UI.Administration.Image.Security
Its Management Pack is:
Microsoft.EnterpriseManagement.ServiceManager.UI.Administration

Once you have found the image that you want to use, make note of the Management Pack that it is in and check the <References> element at the top of the above XML to make sure it is listed.
In the above Management Pack I have added the Microsoft.EnterpriseManagement.ServiceManager.UI.Administration Management Pack and gave it an Alias of “Administration”. I could have quite as easily given it a Alias of “RumpRoast” if I wanted to, the name isn’t important. What IS important is that we use this friendly name to reference anything in that Management Pack throughout our XML.
The Version is important as it has to match the one you have imported in to your SCSM management server and the version may change depending on your version or service pack level so double check by looking in the Administration workspace of your SCSM Console at your Management Packs.
The PublicKeyToken is the same for all MP’s.

  <References>
    <Reference Alias=”EnterpriseManagement”>
      <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Console</ID>
      <Version>7.5.3079.0</Version>
      <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
    </Reference>

    <Reference Alias=”WorkItem”>
      <ID>System.WorkItem.Incident.Library</ID>
      <Version>7.5.3079.0</Version>
      <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
    </Reference>

    <Reference Alias=”Administration”>
      <ID>Microsoft.EnterpriseManagement.ServiceManager.UI.Administration</ID>
      <Version>7.5.3079.0</Version>
      <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
    </Reference>
  </References>

Next, we have to find the Task that we created and the ID that has been generated for it.
Tasks have an element tag of <ConsoleTask> and in the example code above it is:

<ConsoleTask ID=”ConsoleTask.b2b1ee5abd5841a790d8f783e09d93a0″ RequireOutput=”true” Target=”WorkItem!System.WorkItem.Incident” Enabled=”true” Accessibility=”Public”>

The key piece of information we need to gather is the ID.
ConsoleTask.b2b1ee5abd5841a790d8f783e09d93a0

With this ID we can now associate images to the task. But before we do that, we need to make sure we have a reference to an image.
To do this we need to add the <ImageReferences> section under the Presentation section. This gives the management pack a reference to an image that is stored either with the current management pack (Must be sealed and contained within a bundled MP) or, in our case, within an existing MP that we can reference.

<ImageReferences>

<ImageReference ImageID=”Administration!Microsoft.EnterpriseManagement.ServiceManager.UI.Administration.Image.Security” ElementID=”ConsoleTask.b2b1ee5abd5841a790d8f783e09d93a0“/>

</ImageReferences>

This reference is pointing to the Administration reference (highlighted red) and is selecting the image within that reference called
Microsoft.EnterpriseManagement.ServiceManager.UI.Administration.Image.Security (highlighted green).
The reference then states what Element ID that this image is related to and in our case it is ConsoleTask.b2b1ee5abd5841a790d8f783e09d93a0 (highlighted blue)

Save the XML, re-import it and that’s it.

The image is now referenced to the Console Task and when we re-import the Management Pack in to the console the task will now have an icon associated with it. (After restarting the console of course)
clip_image002

You will get a warning that the Management Pack already exists and you may lose data but this is due to the Version number being the same as the one you exported. If you want to avoid this error, just increment the version number in the XML code before importing it.

clip_image003

I hope this helps someone.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s