Error setting up failovers on agents

I was following the section Set failovers for multiple agents from file in this article to setup primary and failover servers on some agents. I wanted to flip the primary and failovers around when I got this error on some of them:

Note: The error output has been abbreviated.

Set-SCOMParentManagementServer : The failover server MGMT_SERVER_ID cannot be the same as the primary server.

The agents that were failing had connections to two gateway servers: GW1 was primary and GW2 was the only failover.

The solution in this case was to add the line (in red) before the other commands:

Set-SCOMParentManagementServer -Agent $Agent -FailoverServer $null
Set-SCOMParentManagementServer -Agent $Agent -PrimaryServer $PrimaryServer
Set-SCOMParentManagementServer -Agent $Agent -FailoverServer $FailoverServer

That's great but why does this happen? I can only think it's a weird SCOM thing where it's seeing GW2 as currently being used therefore can't re-assign it as primary, so we need remove it first (using $null) then we can assign it as primary, which then frees up GW1 to be re-assigned as the failover.

I have updated that original article to include this line but it's commented out.

Comments