Anytime you are building a Management Pack that references another Management Pack you need to add a reference element to your MP. If you are using the Service Manager Authoring Tool it takes care of building this reference for you, but what about when you are authoring your MP in Visual Studio or another xml editor.
First let’s take a look at what properties are needed. Here is an example of what we need to add to our XML file. You will see that we need the ID, Version and PublicKeyToken
There are a few options you can use to get reference information, you could use a combination of manually looking up the ID and version in the SM console and using sn.exe –T to get the publicKeytoken.
But wouldn’t it be nice to be able to get this all in one place? With PowerShell and the SMLets we can get all of the information in one command if you know the full class name you are going to be using from the MP.
Before we jump right to the command we need to know what class we want to reference that is in another Management Pack. For this example I am going to use the business service class, we don’t even need to know what MP the class is in.
If you don't know the full class name you can start out by running Get-SCSMClass –name “BusinessService”
This will return only one object unless you have a custom class or extended the business service class. Now we are ready to get the reference data.
Get-SCSMManagementPack -Name (Get-SCSMClass -name "SystemCenter.businessService" | Select ManagementPack ).ManagementPack | Select Name,Keytoken,Version,DisplayName | FL
I added the DisplayName property to the Select statement just as additional information it is not required.
You are now ready to build your own reference element, you just need to pick an alias name.