How to Create a Class

A management pack class is a structured set of data. You can define your own class from scratch, or you can define your class based on an existing class in your own or any referenced management pack. Management pack classes have properties; each property is a set of information that describes that class. For example, if you wanted to create a class that stored information about bookshelves, you would create a new class named BookShelf. Some properties to describe that bookshelf could be: Height, Width, and ShelfCount.

As your management pack becomes more complex, the number of classes and how they interact with one other will grow. Planning what you are going to do before actually creating it in Service Manager will help you determine the design problems you may experience when building your solution. It is best to create a design before actually creating the classes and properties. This will give you a better idea of what type of classes you will have to create, if you can use existing management pack classes, and what properties you will have to have in order to represent the data.


Unique identifiers such as class names cannot contain localized characters. To guarantee compatibility with System Center use only plain-text UTF-8 characters.

To create a class in the management pack

  1. With reference to your management pack, create a new instance of the ManagementPackClass class.

  2. Set the DisplayName and Description properties.

  3. The Base property must be set to an existing ManagementPackClass object. The System.Entity class from the System.Library management pack is the minimum base class one must inherit from.

  4. Add any properties needed to describe your class’ data. For more information, see

  5. Call the AcceptChanges method on the management pack to commit the new class to System Center.


The following example creates a new class named RePackaging.Request using the System.WorkItem class as the base class.

EnterpriseManagementGroup mg = new EnterpriseManagementGroup("localhost");
ManagementPack workItemMP = mg.ManagementPacks.GetManagementPack("System.WorkItem.Library", "9396306c2be7fcc4", new Version());

ManagementPack mp = new ManagementPack("RePackaging.Library", "RePackaging Library", new Version(1, 0), mg);
ManagementPackClass mpClass = new ManagementPackClass(mp, "RePackaging.Request", ManagementPackAccessibility.Public);

mpClass.Base = workItemMP.GetClass("System.WorkItem");

    <ManagementPack ContentReadable="true" SchemaVersion="1.1" OriginalSchemaVersion="1.1" xmlns:xsd="" xmlns:xsl="">
        <Name>RePackaging Library</Name>
          <Reference Alias="WorkItem">
            <ClassType ID="RePackaging.Request" Accessibility="Public" Abstract="false" Base="WorkItem!System.WorkItem" Hosted="false" Singleton="false" Extension="false" />

Compiling the Code






See Also