Creating a SCOM instance in C#

This post is more as a not to self: How to create a SCOM (SDK) instance for a custom Management Pack in C#:


EnterpriseManagementGroup mg = new EnterpriseManagementGroup(“localhost”);
ManagementPack mp = mg.GetManagementPack(“RePackaging.Library”, null, new Version());
ManagementPackClass requestClass = mp.GetClass(“RePackaging.Request”);
CreatableEnterpriseManagementObject request = new CreatableEnterpriseManagementObject(mg, requestClass);

// Set a property by name
request[requestClass, “SoftwareTitle”].Value = “Software Application A”;

// Set a property by reference
ManagementPackProperty property = requestClass[“Requester”];
request[property].Value = “Domain\\User1”;

// Set a property by identifier (the DisplayName property)
Guid propertyGuid = new Guid(“883cd2bb-eb57-b4ff-bbf2-69b7cf4570dc”);
request[propertyGuid].Value = “Software Application A – Domain\\User1”;


This entry was posted in MP, OpsMgr 2012 and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s