Hacking Management Pack XML Like a Pro

Sometimes when you need to make some changes nothing beats a good ol’ text editor.  There are cases right now where the only way to change something in Service Manager is by editing the management pack XML directly.  There are also cases where it is just faster to edit the XML directly.  To that end… here is a primer on how to edit MPs directly.  (Also, this is a great way to reverse engineer the product but shhh… don’t tell anybody I told you that. ;-))

First, you need to get the management pack out of the database.  For unsealed MPs, this is pretty easy to do. 

1.       In the Service Manager console, go to the Administration workspace.

2.       Click on the Management Packs view.

3.       Select the unsealed management pack you want to export.

4.       Click Export in the task pane. 

5.       You’ll be prompted for the location you want to save the .xml file to. 

For sealed MPs this is a little trickier.  Before we go here, it’s important to keep in mind that sealed MPs usually have dependencies on them and they are signed by Microsoft or a partner so you won’t be able to modify them.  That’s why we discourage people from exporting them.  But if you are just interested in how Service Manager ticks, you can export them using a tool called mpexport.exe. 

1.       To export a sealed MP you need to get the GUID of that MP from the database.  Open SQL Management Studio and select the SMCMDB (to be renamed to ‘ServiceManager’ starting in Beta 2) database.  Run a query like this:


SELECT ManagementPackId, MPName, MPFriendlyName FROM ManagementPack



2.       Now copy the GUID of the MP that you want to export from the result set to your clipboard. 

3.       Open a command prompt (Start -> Run or Windows Key + R, type ‘cmd’, hit enter or from Start menu).

4.       Type cd <location of your Service Manager installation directory> and hit enter

For example the default installation directory for Service Manager:

cd C:\Program Files\Microsoft System Center\Service Manager 2010

5.       Type mpexport <paste the GUID here>

For example to export the System.Knowledge.Libary MP from above:

mpexport DCAF6D66-4CB0-1DDA-FB9A-0B0EC49784E4


6.       This will save the MP .xml file to the same location as mpexport.exe



Update: Starting with Service Manager Beta 2 builds (build # 5037+) the mpexport.exe and mpimport.exe utilities will be removed and replaced by PowerShell cmdlets.  This should make it much easier to export MPs since you don’t need to mess around looking for GUIDs in the database.  Here is an example:

PS> Get-SCSMManagementPack Incident | Export-SCSMManagementPack -Directory c:\temp 

Or, if you are feel like being a PowerShell hotshot you can follow Jim’s approach to exporting MPs en masse.

Now that you have your MP xml file, open it in your favorite text editor. Since these are XML files I suggest opening them in a text editor designed for editing XML files such as Visual Studio , XML Spy, Notepad++.

At first glance looking at an MP in its raw XML form can be pretty daunting especially if it is one of the larger MPs that ship out of the box.  In a lot of cases, especially if something has been generated from the UI, the ID of some of the MP elements may not be distinguishable.   For that reason I recommend starting by looking in the <LanguagePack> section of an MP.  Here you can see the localized display strings for the MP elements in the MP.  For example here is the DisplayString for the All Tier 3 Open Incidents view (click to view full size): 

 Now – to find the element you are looking for in the MP you can search for ‘ID=”<Element ID you are interested in>”’.  For example search for:


This will lead you to the corresponding MP element like this:

You can also see other places where the MP element with that ID is being used by searching for just the ID or by searching for phrases like “Target=<ElementID you are interested in>” or “MPElement=<ElementID you are interested in>” – for example:



That will show you things like this (click to view full size):

Which indicate that the view is part of a category.

Or this (click to view full size):

Which indicates that the view is contained by this folder.

Or this (click to view full size):

Which indicates which icon corresponds to that view.

One thing to keep in mind is that  you cannot delete an MP element like the <View> above without making sure that there are no Target or MPElement references in other MP elements that point to the ID of that MP element (System.WorkItem.Incident.Queue.Tier3.View in this case).  For example, in order to delete this view here, I would first need to delete the corresponding <FolderItem>, <ImageReference>, <Category>, and even the <DisplayString> that we started from.

Editing MPs by hand is not for the faint of heart, but it is a great way to debug problems, make bulk edits, reverse engineer things, do things which cannot be done via the UI, or revert changes that cannot be undone via the UI.

Sometimes it can be a bit of trial and error when it comes to editing MPs by hand, but to help you along (as long as you don’t mind a little reading) I recommend the following resources:

·         Operations Manager 2007 MP Authoring Guide (remember Operations Manager and Service Manager are built on essentially the same platform): http://download.microsoft.com/download/7/4/d/74deff5e-449f-4a6b-91dd-ffbc117869a2/OM2007_AuthGuide.doc

·         http://www.AuthorMPs.com

·         The Service Manager authoring guide available on http://connect.microsoft.com

 Happy MP XML Hacking!

Also, see some of Jim Truher’s posts on this blog for other examples of working with MPs via PowerShell: