Monday 6 December 2010

Type projections, views and unsealed MP's

I was in the process of creating a view to show all Computers, basically a replica of the view under Configuration Items, but within my own management pack.

However, when I went to use the Computer (typical) type project for my view I got this error message:


This happens because the type projection for Computer (typical) is stored in the unsealed MP ServiceManager.ConfigurationManagement.Configuration.xml
This then means that trying to reference this type projection for views in your own MP is impossible without a bit of tweaking.

It's a fairly easy workaround though, simply recreate the type projection in your own MP.
the XML you will need is:

<TypeProjection ID="AllComputers.View.ProjectionType" Accessibility="Public" Type="Windows!Microsoft.Windows.Computer">
<Component Path="$Context/Path[Relationship='ConfigurationManager!Microsoft.SystemCenter.ConfigurationManager.DeployedComputerRunsWindowsComputer' SeedRole='Target']$" Alias="PhysicalComputer" />
<Component Path="$Context/Path[Relationship='Windows!Microsoft.Windows.ComputerHostsOperatingSystem']$" Alias="OperatingSystem" />
</TypeProjection>

You'll need to make sure you've got some references in as well, either use these, or if you've already got them referenced, change the code above to match your reference:

<Reference Alias="Windows">
<ID>Microsoft.Windows.Library</ID>
<Version>7.0.5826.0</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>

<Reference Alias="ConfigurationManager">
<ID>Microsoft.SystemCenter.ConfigurationManager</ID>
<Version>7.0.5826.0</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>

Finally, add a display string and make sure you change the name so that it differs from the built in type projection "Computers (typical)".

<DisplayString ElementID="AllComputers.View.ProjectionType">
<Name>Computer (typical - for custom views)</Name>
<Description>Defines the properties of computers typically used in views</Description>
</DisplayString>

2 comments:

srikanth said...

We use USB device to transfer data into our PC and Laptops
www.windowslibrary.org/

McAfee Cloud said...

Hi, the post which you have provided is fantastic, I really enjoyed reading your post, and hope to read more. Thank you so much for sharing this post, I appreciate your work.


To enjoy our services more visit on:norton.com/setup