Deleting a Specific Category of Rules from a SCOM 2012/2016 Management Pack

Ever wanted to delete a specific category of rule from a SCOM Management Pack? For example you might want to delete all alerting rules or disable performance collection rules, or maybe event collection rules. Whatever your desire, yes it can be done. Let me show you how!

WARNING: This code will delete all Monitors/Rules from your Unsealed MP…so make sure you have a backup just in case! If you’d prefer to simply ‘disable’ them, check out my previous posts.

  • Alert
  • AvailabilityHealth
  • ConfigurationHealth
  • ConnectorFramework
  • Custom
  • Discovery
  • DSIntegration
  • EventCollection
  • ExceptionMonitoring
  • Maintenance
  • Notification
  • Operations
  • PerformanceCollection
  • PerformanceHealth
  • SecurityHealth
  • SoftwareAndUpdates
  • StateCollection
  • System


# Delete All Rules of a Specific Category from an Unsealed Management Pack
# This example deletes all “PerformanceCollection” Rules

# Valid Categories are: Alert, AvailabilityHealth, ConfigurationHealth, ConnectorFramework, Custom,
# Discovery, DSIntegration, EventCollection, ExceptionMonitoring, Maintenance, Notification,
# Operations, PerformanceCollection, PerformanceHealth, SecurityHealth, SoftwareAndUpdates
# StateCollection, System

$Delete = [Microsoft.EnterpriseManagement.Configuration.ManagementPackElementStatus]::PendingDelete

$ManagementGroup = Get-SCOMManagementGroup

$mp = Get-SCOMManagementPack | ? {$_.Name -eq “Culham.Custom.Monitoring.MP”}
$allmprules = Get-SCOMRule -ManagementPack $mp
$mprules = $allmprules | ? {$_.Category -eq “PerformanceCollection”}
foreach ($mprule in $

$rule = $ManagementGroup.GetMonitoringRule(“$mprule”)
$rule.status = $Delete



Just remember, deleting is permanent…

Leave a Reply

Your email address will not be published.