You can query for rules that have a non-category override by defining criteria in the Microsoft.EnterpriseManagement.Configuration.MonitoringRuleCriteria class constructor. The criteria syntax is defined in Criteria Expression Syntax.

The following code example queries for all the rules that have a non-category override.

C#  Copy Code
/// <summary> 
/// Query for rules that have a non-category override.
/// </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
			// all the rules that have a non-category override.
			MonitoringRuleCriteria ruleCriteria =
				new MonitoringRuleCriteria(
				"HasNonCategoryOverride = 1");

			Console.WriteLine("Querying for data...");
			ReadOnlyCollection<MonitoringRule> monitoringRules =

			// Display information about each rule.
			foreach (MonitoringRule rule in monitoringRules)
				Console.WriteLine("Rule name: " + rule.Name);
				Console.WriteLine("Category: " + rule.Category);
				Console.WriteLine("Enabled: " + rule.Enabled.ToString());
				Console.WriteLine("Has non-category override: " + rule.HasNonCategoryOverride);
				Console.WriteLine("Description: " + rule.Description +

Send comments about this topic to Microsoft.