Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

How to Query for Management Packs

System Center

Updated: May 22, 2009

Applies To: Operations Manager 2007 R2, Operations Manager 2007 SP1, System Center Operations Manager 2007

In Operations Manager 2007, Management Packs are XML files that can have either an .mp or an .xml extension and can contain monitoring settings for applications and services. After a Management Pack is imported into a Management Server, it immediately begins monitoring objects based on default configurations and thresholds that are already set by the author of the Management Pack. You can query for Management Packs by defining criteria in the ManagementPackCriteria class constructor. The criteria syntax is defined in Criteria Expression Syntax. The following property names are valid names that can be used in the criteria expression:

  • Id

  • Sealed

  • Name

  • FriendlyName

  • Version

  • KeyToken

  • LastModified

  • TimeCreated

  • DisplayName

  • Description

  • VersionId

The following code queries for all Management Packs that were created after 10/25/2006.

/// <summary> 
/// Query for Management Packs.
/// </summary>
using System;
using System.Collections.ObjectModel;
using Microsoft.EnterpriseManagement;
using Microsoft.EnterpriseManagement.Configuration;
using Microsoft.EnterpriseManagement.Monitoring;

namespace SDKSamples
    class Program
        static void Main(string[] args)
            ManagementGroup mg = new ManagementGroup("localhost");

            // The criteria specifies that you want to collect
            // sealed management packs created after 10/25/2006.
            ManagementPackCriteria mpCriteria =
                new ManagementPackCriteria(
                "Sealed = 1 AND TimeCreated >= '" + 
                new DateTime(2006, 10, 25).ToString("G") + "'");

            Console.WriteLine("Querying for data...");
            ReadOnlyCollection<ManagementPack> managementPacks =

            // Display information about each Management Pack.
            foreach (ManagementPack mp in managementPacks)
                Console.WriteLine("Monitor name: " + mp.Name);
                Console.WriteLine("Sealed: " + mp.Sealed);
                Console.WriteLine("Id: " + mp.Id);
                Console.WriteLine("Description: " + mp.Description +

© 2015 Microsoft