Here's an easy script to set the primary and secondary management servers for all agent managed computers in your management group. Just run this on any management server:



$primaryMS = (Get-SCOMManagementServer | Sort-Object DisplayName )[0]
$failoverMS = (Get-SCOMManagementServer | Sort-Object DisplayName )[1]
Get-SCOMAgent | % { Set-SCOMParentManagementServer -Agent $_ -PrimaryServer $primaryMS; `
Set-SCOMParentManagementServer -Agent $_ -FailoverServer $failoverMS}
Get-SCOMAgent | Select @{Label="Agent"; Expression={$_.Displayname}}, @{Label="Primary MS"; `
Expression={$_.PrimaryManagementServerName}}, @{Label="Failover MS Server(s)"; `
Expression={$_.GetFailoverManagementServers().DisplayName}} | Format-Table -Autosize

 

Enjoy.