Move Agents to New Server

Joseph Setaro 121 Reputation points
2021-07-25T02:01:10.453+00:00

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?

Operations Manager
Operations Manager
A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.
1,482 questions
{count} votes

Accepted answer
  1. Joseph Setaro 121 Reputation points
    2021-07-28T15:05:54.37+00:00

    Hello,

    I was able to transfer the RMS Emulator role to my new server. It is now the primary management server. However, I am not able to log into the console. The Data Access service keeps stopping, and Im getting an error stating that the server refused a connection to IP:5724. My FW is disabled, and the AV as well.


2 additional answers

Sort by: Most helpful
  1. Crystal-MSFT 48,756 Reputation points Microsoft Vendor
    2021-07-26T02:00:36.24+00:00

    @Joseph Setaro , The agents are grayed out because they are not remotely manageable, we can change this by following Kevin's blog post below:
    https://kevinholman.com/2010/02/20/how-to-get-your-agents-back-to-remotely-manageable-in-scom/
    Note: Non-Microsoft link, just for the reference.

    For the Powershell commands In the Example 1 of the following link, it mentioned the server01.contoso.com means the agent. In our first example in our thread, it sets new server agent's Primary server as its own and set old server agent's Failover Management server's as its own. Here is the link for the reference:
    https://learn.microsoft.com/en-us/powershell/module/operationsmanager/set-scomparentmanagementserver?view=systemcenter-ps-2019#examples

    For our situation, we can try the following commands, to change all the agents' Primary Management server:
    $PrimaryMgmtServer = Get-SCOMManagementServer -Name "old-server-fqdn"
    $FailoverMgmtServer = Get-SCOMManagementServer -Name "new-server-fqdn"
    Get-SCOMAgent | Set-SCOMParentManagementServer -PrimaryServer $PrimaryMgmtServer -Passthru

    Then check if the PrimaryManagement server of all the agents are changed.
    Get-SCOMAgent | fl name,PrimaryManagementServerName

    After it is changed, we can run the following command to set the Failover Management server:
    Get-SCOMAgent | Set-SCOMParentManagementServer -FailoverServer $FailoverMgmtServer -Passthru

    Please try the above command and if there's any error, feel free to let us know.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. System Center guy 691 Reputation points
    2021-07-26T04:57:19.303+00:00

    > 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.

    with refer to your error, error occurred when you assign primary and failover server to same management server.

    1. check whether "a secondary server" is a failover server of the agent
    2. if "secondary server" is failover server of the agent, remove it role from the agent
    3. set the primary management server and failover management server of the agent to the "new server" and "old server" respectively

    Roger

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.