SCOM 2012 – Get Agent Failover Management Server

Because of an issue I needed to get the failover management servers of the agents. Well, because I like to fool around with Powershell I thought I would write a short script.

Just to give you some background how I figured it out. First I got the members of the Get-SCOMAgent command by typing:

Get-SCOMAgent | Get-Member

You will likely see something like this…

image

As you see GetFailoverManagementServers is a collection, therefore this method could contain more than one entry. PrimaryManagementServerName is just a simple string property so we don’t have to do anything special.

With this background I wrote this script which dumps all agents with its primary management server and its failover server. It also indicates if the primary management server is a gateway or not.

You can call the script with an agent name and the script will dump just the servers for the one agent or without any parameter it just dumps the information for all agents.

.\Get-FailoverManagementServer.ps1 “server.domain.com”

or

.\Get-FailoverManagementServer.ps1

image

The script looks like this…

image

…and you can download it here.

Cheers,

Stefan

4 Comments

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s