Welcome to MSDN Blogs Sign in | Join | Help

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: 

param($agentComputerName,$failoverManagementServerName)

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

$primaryManagementServer  = $agent.GetPrimaryManagementServer();

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


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

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


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


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

$failoverServers.Add($failoverManagementServer)

$agent.SetManagementServers($primaryManagementServer,$failoverServers)

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:'agent1.contoso.com'  -failoverManagementServerName:'mgmtsrv2.contoso.com'

 

Published Tuesday, September 11, 2007 9:40 PM by Boris Yanushpolsky
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# MSDN Blog Postings » Setting specific failover management servers

# re: Setting specific failover management servers

Friday, October 26, 2007 4:05 PM by jerobert

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

# re: Setting specific failover management servers

Monday, December 17, 2007 12:04 PM by Laurent DE BERTI

The script works to define the failover of gateway ?

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

BR/Laurent

# re: Setting specific failover management servers

Friday, October 10, 2008 11:42 AM by Mark

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?

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker