PowerShell Overrides – Not only Enable/Disable

Microsoft’s SDK holds lots of hidden cards that sometimes need lots of reading to understand.

So, from time to time I will upload PowerShell scripts that will help to create some cool PowerShell tools.


Today I want to share with you a small scripting trick to be used with PowerShell on SCOM 2012 R2 to create Rule & Monitor Overrides.

In Scom 2012 we got some nice new commands that can disable and enable monitors (Disable-Scommonitor), but what about changing values?

On TechNet there is a good link on how to create an override in C#, have a look at how to do that in PowerShell:


Create an override for Monitors with a list from CSV file.

#connection to SCOM
Import-Module OperationsManager
New-SCOMManagementGroupConnection -ComputerName $MSServer
#Load csv file, the file format is Monitor Name,Class Name,Parameter to be changed 
#in a monitor you can change the next parameters:
# * Enabled
# * GenerateAlert
# * AutoResolve
# * AlertPriority
# * AlertOnState
# * AlertSeverity
#load the csv file
$CSVfile = Import-Csv -Path $CSVFileLocation
#get the scom management pack that will hold the overrids
$mp = Get-scomManagementPack -DisplayName “$ManagementPack“
foreach ($line in $CSVfile)
        $Monitor = get-scommonitor -displayname $line.Name #get monitor from the csv file
        $Monitor = [Microsoft.EnterpriseManagement.Configuration.ManagementPackElementReference“1[Microsoft.EnterpriseManagement.Configuration.ManagementPackMonitor]]::op_Implicit($Monitor);
        $Target = get-scomclass -displayname $line.class #get class holding the monitor
  if ($Monitor -and $Target) #you can add any condition you want
   $OverrideID = “Override.” + $monitor.name #you must have a unique name
   $Override = New-Object Microsoft.EnterpriseManagement.Configuration.ManagementPackMonitorConfigurationOverride($mp,$OverrideID)
   $Override.Monitor = $monitor                           
   $Override.Parameter = “Priority” 
   $Override.Value = $line.priority 
   $Override.Context = $Target      
   $Override.DisplayName = “Global Override”  #Name the override in the console

# In this case, I used the Priority as the value for the override – you need to know the value that the parameter can hold, In this case only 0,1,2.

For the same script to work with Rules you need to make some changes


$Override = New-Object Microsoft.EnterpriseManagement.Configuration.ManagementPackMonitorConfigurationOverride($mp,$OverrideID)

Needs to be :

$Override = New-Object Microsoft.EnterpriseManagement.Configuration.ManagementPackRuleConfigurationOverride($mp,$OverrideID)


A new line needs to be added to the in the section where you specify the override itself

$override.Module = “Alert”

Now the module is changing rules and if you want to override other you need to find their module names.

Be careful because in some cases the module you are trying to change is missing from the rule. For example, collection rules don’t have an Alert module and the script will fail

You can make lots of changes. You need to add additional conditions for the MP to be able to upload it, but as a starting point, it’s good enough.


One Comment

Add a Comment

Your email address will not be published. Required fields are marked *