Setting specific failover management servers

Unless you are using AD integration, when the agent cannot communicate with its primary management server, it can pick up any management server to failover to. The only way in the console to provide a specific list of failover servers is it use AD integration. If you are not using AD integration but still want to specify particular failover servers for agents, here is a script that can help: 


$agent = get-agent | where {$_.PrincipalName -eq $agentComputerName}

$primaryManagementServer  = $agent.GetPrimaryManagementServer();

if($primaryManagementServer -eq $null)
"Primary management server not found"

$failoverManagementServer = Get-ManagementServer | where {$_.PrincipalName -eq $failoverManagementServerName}

if($failoverManagementServer -eq $null)
"Failover management server not found"

if($failoverManagementServer.PrincipalName -eq $primaryManagementServer.PrincipalName)
"The failover management server cannot be the same as the primary management server"

$failoverServers = New-Object System.Collections.Generic.List``1"[[Microsoft.EnterpriseManagement.Administration.ManagementServer,Microsoft.EnterpriseManagement.OperationsManager,Version=6.0.4900.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35]]"



Steps to run the script:

1 - Save the script to a PS1 file.

2 - Open the OpsMgr Command Shell

3 - Run the script and pass the agent fqdn and the failover server fqdn. Here is an example: C:\SpecifyFailoverServer.ps1 -agentComputerName:''  -failoverManagementServerName:''


Comments (4)
  1. jerobert says:

    Thats great info but how would I specify an agent to report to a different Root Mangement Server? I want to move agents that were installed during a test lab to our production Scom Installation

  2. Laurent DE BERTI says:

    The script works to define the failover of gateway ?

    The function GetPrimaryManagementServer() return an error for servers that have as primaryManagementServerName a gateway


  3. Mark says:

    Can you specify multiple failover servers? How would you do that in the script?

    Also, when multiple failover servers are specified, does it first attempt to connect to the first one in the list and works it’s way down?

Comments are closed.

Skip to main content