Quantcast
Channel: Operations Manager - General forum
Viewing all articles
Browse latest Browse all 11941

Agent Failover to Prefered Multiple Secondary Servers

$
0
0

I'm attempting to use a powershell script to configure my agents to failover to a list of specific secondary MS's, in a specific order.  The desired behavior is to fail over to the secondary MS in the same DC, and failing that go to the secondary MS in the backup DC.

The script I used is as follows (server names sanitized) :

Import-Module OperationsManager
New-SCOMManagementGroupConnection <server>
$primaryMS = Get-SCOMManagementServer -Name "<DC1PrimaryMS>"
$failoverMS = Get-SCOMManagementServer -Name "<DC1SecondaryMS>","<DC2SecondaryMS>"
$agent = Get-SCOMAgent | where {$_.Name -like "<DC1Agents>"}
Set-SCOMParentManagementServer -Agent $agent -PrimaryServer: $primaryMS
Set-SCOMParentManagementServer -Agent $agent -FailoverServer: $failoverMS
get-scomagent|where {$_.Name -like <DC1Agents>} | ft -a ComputerName,primarymanagementservername,@{l=”secondary”;e={$_.getfailovermanagementservers()|foreach{$_.name}}} | Out-File C:\SCOM\Scripts\AgentFailoverDC1.txt

The issue I have is the resultant output always shows <DC2SecondaryMS> as the first failover MS, no matter which order I set them in the $failoverMS variable, as shown in the output below.  

ComputerName   PrimaryManagementServerName               secondary                                                                            
------------   ---------------------------               ---------                                                                            
<DC1Agent> <DC1PrimaryMS> {<DC2SecondaryMS>, <DC1SecondaryMS}

As the server names of the 2 failover MS's initially showed up in the variable in the incorrect order (due to their name), I modified this line to:

$failoverMS = Get-SCOMManagementServer -Name "<DC1SecondaryMS>","<DC2SecondaryMS>" | Sort-Object DisplayName -Descending

Now I can see the $failoverMS variable has the servers in the desired order, however it still has no effect in the Set-SCOMParentManagementServer -Agent $agent -FailoverServer: $failoverMS cmdlet as it still returns the servers out of the desired order.

Any ideas?

Cheers,

Mike


Viewing all articles
Browse latest Browse all 11941

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>