SCOM Overrides PowerShell script for bulk delete

Hello everyone, if you ever needed to perform a bulk delete of SCOM overrides, you can use the following method.

Start by creating an object that contain the management pack that holds the overrides you want to delete:

 $mp = Get-SCOMManagementPack -DisplayName 'MP_Containing_Overrides' 

Now you need to find the overrides. I used some PowerShell commands to find all the overrides I want to delete and stored them in an object array but you can use this trick:


$MonitorsWithOverrides = Get-SCOMMonitor | Where (put some clause here)

$Overrides2Delete = Get-SCOMOverride -Monitor $MonitorsWithOverrides

Make sure that the list of overrides is intact the one you want to delete.

Now you to change the status of each override to a PendingDelete status.

 foreach($Override in $Overrides2Delete){$Override.Status = [Microsoft.EnterpriseManagement.Configuration.ManagementPackElementStatus]::PendingDelete}

That should do it. You can verify this by checking the overrides in the array, check their status is actually PendingDelete.

All you have to do now is to update the management pack file with the new changes:

 $mp.AcceptChanges() 

What do you think about this post?