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…
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.
The script looks like this…
…and you can download it here.