Monday, June 8, 2015

SCOM 2012 R2 PowerShell: Enumerate All SCOM MS & Gateway Servers & Count All MMA’s Reporting To Them

Suppose you’re running a big SCOM 2012 R2 environment. Many SCOM 2012 R2 Management Servers (MS) and Gateway Servers (GW’s) are deployed. Many Microsoft Monitoring Agents (MMA’s) are out there as well.

And now you want to have a quick overview of how many SCOM 2012x MS server you’ve got in total. Like wise for the GW’s AND you want to know per MS/GW how many MMA’s are reporting to it.

Yes. It can be done by clicking through the Console. And yes, you can run a Report for it.

I race you!
But – like with many other things in your work – it has to be done QUICK! So now PowerShell comes into play since it goes way much faster with some good PowerShell cmdlets.

Therefore I’ve made this PS script which connects to your SCOM 2012 R2 MG and enumerates all MS servers, GW’s and counts the MMA’s reporting to the related MS/GW server. It puts the output on the screen AND into a file (Enum_MS_GW_MMA.txt), located in the folder C:\Server Management. At the end of the PS script this file is opened in Notepad for you, so you don’t have to browse to it.

The only thing you’ve got to modify in this PS script is the entry for the FQDN of one of your SCOM 2012 R2 MS Servers:

After that, save it and run it.

Also with this PS script I used other resources. In this case I used a PS script written by Jimmy Harper in order to obtain more detailed information about the SCOM Gateway Servers. You can find this posting, written by Jimmy, here.

You can download the script from here.

No comments: