While working on a recent System Center Operations Manager 2012 SP1 deployment (this method also works with SCOM 2012 RTM) I needed to export all of the Rules and Monitors from a specific management pack. This can be very useful when deciding what thresholds and overrides should be enabled for a particular environment. The process is similar to that of SCOM 2007R2, but with slightly different syntax. First, you need to identify the name of the management pack for which you would like to obtain the Rules and Monitors. Open the Operations Manager Shell and issue the following command: Get-SCOMManagementPack
The output should be something similar to the following:
Next, find the name of the management pack (referenced by the "Name" column in the above output) and attach the specified management pack to a Powershell variable using the following command (replacing client monitoring with the management pack of your choice): $mp = Get-SCOMManagementPack -Name Microsoft.SystemCenter.ClientMonitoring.Library
After you have retrieved the proper management pack, you can output a list of Rules using the following command (be sure to input the variable name in the command, as seen below): Get-SCOMRule -ManagementPack $mp | Select DisplayName, Description, Name, Enabled, Target | Export-Csv -Path Rules.csv
Likewise, you can export Monitors using the following command: Get-SCOMMonitor -ManagementPack $mp | Select DisplayName, Description, Name, Enabled, Target | Export-Csv -Path Monitors.csv
After issuing these two commands, you will have a CSV-formatted file with each Rule and Monitor listed as a specific line item. The output will include the field names specified in the command line parameters; in this particular case, we chose DisplayName, Description, Name, Enabled and Target. You can feel free to adjust these parameters based on your specific needs.