Manipulating Extended Class Properties using the SDK
Published Feb 15 2019 02:26 AM 129 Views
First published on TECHNET on Mar 16, 2010

OK, great job! You've figured out how to extend classes . Now, how do you programmatically access them? I wrote up this quick example to show you how you can extend the Microsoft.Windows.Computer class with a couple of properties and then create an object of that class and populate the values of those properties.

Here we go! First a simple management pack to extend the Microsoft.Windows.Computer class:

<ManagementPack ContentReadable="true" SchemaVersion="1.1"








<Name>Configuration Items Extension</Name>


<Reference Alias="WinLib">










<ClassType ID="TestMP.ExtensionClass" Accessibility="Public" Base="WinLib!Microsoft.Windows.Computer" Extension="true">

<Property ID="MySerialNumber" Type="string" />

<Property ID="MyAssetTag" Type="string" />






<LanguagePack ID="ENU" IsDefault="true">


<DisplayString ElementID="TestMP.ExtensionClass" SubElementID="MySerialNumber">



<DisplayString ElementID="TestMP.ExtensionClass" SubElementID="MyAssetTag">







Next – here is a simple console application that creates a new object of that class:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Microsoft.EnterpriseManagement;

using Microsoft.EnterpriseManagement.Common;

using Microsoft.EnterpriseManagement.Configuration;

namespace CreateServer


class Program


static void Main(string[] args)


EnterpriseManagementGroup emg = new EnterpriseManagementGroup("localhost");

ManagementPackClass clsWindowsComputer = emg.EntityTypes.GetClass(new Guid("EA99500D-8D52-FC52-B5A5-10DCD1E9D2BD")); //This GUID represents the Microsoft.Windows.Windows.Computer class

ManagementPackClass clsWindowsComputerExtension = emg.EntityTypes.GetClass(new Guid("35097F79-9E81-AB9C-8553-81D71243D9DA")); //This GUID represents the TestMP.ExtensionClass class

EnterpriseManagementObjectProjection emopServer = new EnterpriseManagementObjectProjection(emg, clsWindowsComputer);

emopServer.Object[clsWindowsComputer, "PrincipalName"].Value = ""; //This is the key property and must be set

emopServer.Object[clsWindowsComputerExtension, "MySerialNumber"].Value = "123";

emopServer.Object[clsWindowsComputerExtension, "MyAssetTag"].Value = "456";





That's it!   Import your MP, run your command line application and now you’ll have a computer in the UI that looks like this:

The key here is to use your extended class ID when getting/setting the extended class properties.

Source files are available here:

Version history
Last update:
‎Mar 11 2019 08:24 AM
Updated by: