Script

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 Replies to “SCOM 2012 – Get Agent Failover Management Server

    1. Hi Superman

      Sure, instead of using Write-Host just dump the string data into a file like this
      “My Text” | Out-File -FilePath c:tempfile.txt -Append
      Of course you need to fit it into the script accordingly, but this shouldn’t be a problem for Superman.

      Cheers,

      Louise Lane

      1. Would I need to just replace the Write-Host -ForegroundColor Red (“Failover Server: ” + ” “*37 + $server.DisplayName) or every Write-Host entry?

Leave a Reply to Clark Kent Cancel reply

Your email address will not be published. Required fields are marked *

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