Custom SCOM 2012 PowerShell Module – Version 1.3

A while ago I created PowerShell Module for SCOM 2012. This are the “CMDlet-s” which are currently available:


This Module was updated on 7.10.2014. Current version is 1.3

Changes from previous release:

4 CMDlets were added:

Now lets go step by step and check what each one does.

But first let me explain that some monitors states are differently named under the hood of OpsMgr. For example monitor in Healthy state is in SCOM language “Success”:

Second I will also explain is how to load this module. It is the same as with any other module. Browse with powershell in folder where MySCOMcmdlets.psm1 resides and run:
Import-Module .\MySCOMcmdlets.psm1

OK now lets go into the details of functions..


This function returns all “Monitor instances” that are in particular state. Default value of monitor is Error.

Here is an example below command returns all “Buffer Cache Hit Ratio” Monitors of all Class instances that are in Error state:

Get-MySCOMMonitorErrorStatus “Buffer Cache Hit Ratio” -State “Success”

Server Name:
Monitor Name: Buffer Cache Hit Ratio
Monitor State: Success
Server Name:
Monitor Name: Buffer Cache Hit Ratio
Monitor State: Success


This function resets health of all Class instances that are in particular State.

Reset-MySCOMMonitorStatus “Buffer Cache Hit Ratio”
Reseting Health for: Buffer Cache Hit Ratio

Also a bunch of data is returned: TaskId, BatchId,…


Using wildchard is also possible but be aware if you set scope too high monitors that you do not want them to be reseted could be reseted. I would not advise to use Reset-MySCOMMonitorStatus * 🙂

Reset-MySCOMMonitorStatus “Service Principal Name Config*” -State “warning”
Reseting Health for: Service Principal Name Configuration Status


Sometimes we repair something and we would like to recalculate Monitor for all instances. It that case use below fuction.

Update-MySCOMMonitorStatus “Buffer Cache Hit Ratio”
Recalculating Health for: Buffer Cache Hit Ratio

Also a bunch of data is returned: TaskId, BatchId,…


This functions returns provided monitor parents, so we can for example easier find monitor through Health explorer so we can get previous states.

Get-MySCOMMonitorParents “Health Service Handle Count Threshold”
Entity Health
└System Center Management Health Service Performance
└System Center Management Health Service Memory Utilization
└Health Service Handle Count Threshold


Last but not least this function returns rule configuration. If we for example want quickly see what is default value of frequency for a particular rule we can use this function. At first glance output seems cryptic but when we look closer we can see: <Fr
equency>300</Frequency> Which means that this rule is trigered every 300 Seconds.

Get-MySCOMRuleConfiguration “System Processor Queue Length Windows Server 2012″

DisplayName        : System Processor Queue Length Windows Server 2012
Name               : Microsoft.Windows.Server.6.2.OperatingSystem.SystemProcessorQueueLength.Collection
ManagementPackName : Microsoft.Windows.Server.2012.Monitoring
Enabled            : true
XmlTag             : Rule
Description        : Collection rule for the performance counter System\Processor Queue Length.
Configuration for: System Processor Queue Length Windows Server 2012 is:

Processor Queue Length</CounterName><ObjectName>System</ObjectName><InstanceName/><AllInstances>false</AllInstances><Fr

This function also excepts wildchards:
Get-MySCOMRuleConfiguration “System Processor Queue Lengt*”


This function Adds SCOM Agent(s) to Management Group. You can provide single or multiple servers. This function excepts wildchards.

Sample: Add-mySCOMAgentToManagementGroup “Server01″,”Server02″,”Server03” -ManagementGroupName “Mgmt01” -ManagementServerName “”
Default port: 5723 is used

Note: Agent has to be connected to one of management groups. If you would like to manipulate Agent Management Group membership directly, you can use Script in this Post


This function displays Management Group(s) of Microsoft Monitoring Agent(s)
Sample: Get-mySCOMAgentManagementGroup “Server*”,”SQLSrv*”


This function REMOVES Management Group from Microsoft Monitoring Agent(s)
Sample: Remove-mySCOMAgentManagementGroup “Server*”,”SQLSrv*” -ManagementGroupName “MGMT01”


This function returns Connected users to Management Group
Usage: Get-MySCOMConnectedUsers


Module can be downloaded from Here

That is it for now. Stay tuned since module will be extended in the future 😉

Share knowledge and ask questions. There are no stupid questions, just stupid answers. 😉

Oh and one more thing. Names of “cmdlets are not by the book. I always ad “My” in between: for example Get-MySCOMtest so I can select them faster and also to differentiate my Cmdlets from built in ones.

C U Soon

This entry was posted in Operations Manager, PowerShell and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s