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'
Comments
- Anonymous
September 11, 2007
PingBack from http://msdnrss.thecoderblogs.com/2007/09/11/setting-specific-failover-management-servers/ - Anonymous
October 26, 2007
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 - Anonymous
December 17, 2007
The script works to define the failover of gateway ?The function GetPrimaryManagementServer() return an error for servers that have as primaryManagementServerName a gatewayBR/Laurent - Anonymous
October 10, 2008
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?