Hello,
I am trying to de-commission my old SCOM server that is running 2012 R2 UR13. I have a VM setup with the same version of SCOM and UR, and I installed it as a secondary server. The option to "Change Primary Management Server" is greyed out, so I have been using Powershell commands. These are all of the commands I tried:
$PrimaryMgmtServer = Get-SCOMManagementServer -Name "old-server-fqdn"
$FailoverMgmtServer = Get-SCOMManagementServer -Name "new-server-fqdn"
"new-server-fqdn" | Get-SCOMAgent | Set-SCOMParentManagementServer -PrimaryServer $PrimaryMgmtServer -Passthru
"old-server-fqdn" | Get-SCOMAgent | Set-SCOMParentManagementServer -FailoverServer $FailoverMgmtServer -Passthru
$serverfrom = Get-SCOMManagementServer | ? {$.name -eq "old-server-fqdn"}
$agents = Get-SCOMAgent -ManagementServer $serverfrom
$serverto = Get-SCOMManagementServer | ? {$.name -eq "new-server-fqdn"}
Set-SCOMManagementServer -AgentManagedComputer:$agents -PrimaryManagementServer:$serverto
$primaryMS = Get-SCOMManagementServer -Name "<old-server-fqdn>"
$failoverMS = Get-SCOMManagementServer -Name "<new-server-fqdn>"
$agent = Get-SCOMAgent -Name "<name of agent>"
Set-SCOMParentManagementServer -Agent $agent -PrimaryServer $primaryMS
Set-SCOMParentManagementServer -Agent $agent -FailoverServer $failoverMS
Set-SCOMParentManagementServer -PrimaryServer $PrimaryMS -FailoverServer $FailoverMS -Passthru
$primaryMS = Get-ManagementServer | where {$.Name -eq 'ACAD08.domain.com'}
$failoverMS = Get-ManagementServer | where {$.Name -eq 'ACAD19.domain.com'}
$agent = Get-agent | where {$_.Name -like '*.domain.com'}
Set-ManagementServer -AgentManagedComputer: $agent -PrimaryManagementServer: $primaryMS -FailoverServer: $failoverMS
None of these have worked. When I try to move the agents to the new server, and set it to primary, I get an error that the primary and failover cannot be the same. Does anybody have a command that works with SCOM 2012 R2 that will move the agents to the new server and change the primary server?