System Center Operations Manager 2012 “More that meets the eye” Part 2–SCOM 2007R2–SCOM2012 PowerShell

This is the second post in my “More that meets the eye” series which has it’s focus on PowerShell in SCOM 2012. To fully understand the changes you will need to read the entire series.

Part 1 –


First of all thanks for the positive feedback on the first post! It always nice to know the effort is appreciated.Smile I hope I can life up to you expectations.

The feedback surely put me in the vibe to write this second edition and I finished it already yesterday. But for some reason I decided to give it a good night sleep before posting……

Bad, bad, very bad idea…..after a long drive to my TAP customer…turned on my laptop and….PXE boot….My week old Lighting fast SSD died in front of my eyes.

I thought that they mend the speed of the disk with “lighting fast” not it’s life time Baring teeth smile

No problem backup at hand but the rocking PowerShell post I had for you will always stay a mystery.

Just needed to get this of my chest now on with the second edition of this post.Smile



Let’s start this series again with a side by side example of SCOM 2007 R2 and SCOM 2012:

Let’s take a look at a really hard change to spot!

2007 R2


image image

Yes I know this one actually is hard to spot I will try to give you some guidance!

I know it is hard to spot this one but look closely and you will be amazed what you will find….


didn’t find it, right?

Well I will tell you:

Did you notice the word “SCOM” if front of nearly every command and when you try harder you will notice “SC” as well.Winking smile

Ok to be honest this one is really obvious it is a textual change on every command in SCOM 2012!

For a full review on the commands changed please take a look at this post from Stefan Stranger, Microsoft PFE –


Is this really only a textual change?

Well to be honest yes and no.

Let me try to explain the differences first by the use of a couple of examples “from the field”.

The System Center Central field this is

Simple PowerShell

Well first one is Scott Moss famous for his one liners! Winking smile


The results


Well this makes sense since they renamed every command this is the result the command isn’t recognized!

You will need to change the one line in :

get-SCOMalert -criteria ‘ResolutionState = ”0” AND Severity = ”2”’ | where-object {($_.IsMonitorAlert -eq $True)} |Group-Object Name |Sort -desc Count | select-Object Count, Name |Format-Table -auto

The result after changing the command:


Ok now we know we need to get ourselves adjusted to “learning” the new commands.

Does this mean we need to alter all our PowerShell scripts?

Let’s double check to be sure

Advanced PowerShell

This example is from Andreas Zuckerhut –


The script will check for management pack dependencies.

Now let’s run this one as well.

The result


This script works without any changes or additions!!!!

There is a good explanation for this if you look more closely you will notice why this script runs ok and why the one liners are failing.

The reason is one line of code :

Add-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client

This line of code tells PowerShell to load the Snapin Microsoft.EnterpriseManagement.OperationsManager.Client

The spanin is the “old” one used in SCOM 2007 R2 Operations Manager Shell which is still around. (More that meets the eyeWinking smile)

The script will tell to load this snapin before running the command and this snapin will recognize the old commands and runs successfully!

***Note When your scripts have the old snapin loaded it is pretty save to say the scripts will continue to work without any problem. I didn’t test this on every script but I see no reason why not.

Although this still works it might be a good idea to develop your scripts from now on using the new module.



Simple one liners

The new Operations Manager Shell has undergone a major change with every command and you might want to check the commands otherwise they don’t work.

Or just put “SCOM” in front of your old commands!

Advanced Scripts

The more advanced script will continue to load the old snapin and therefore no problems when Microsoft.EnterpriseManagement.OperationsManager.Client is loaded!

The Series

These are the changes on PowerShell in a quick glance you are free to dive deeper if you want to Smile

Still this is a step closer to understand the “More that meets the eye series”

The next version will follow in a couple of days, the title will stay a mystery just stay tunedWinking smile




One thought on “System Center Operations Manager 2012 “More that meets the eye” Part 2–SCOM 2007R2–SCOM2012 PowerShell

  1. Pingback: Enabling Default Proxy for SCOM 2012 Agents - SCOMzilla - Site Home - TechNet Blogs

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.