When in SCOM you go to change the primary management server on a SCOM agent but you cannot. It is grayed out.
More details about this issue referenced on the following links:
I built a quick script to help with this. It can be used in any SCOM environment. Details are as follows:
This script can be used to move agents from one management server or gateway server to another.
There is a common issue “Cannot change SCOM agents Primary Management via the GUI (SCOM Console)”. This script can be used to help with this issue.
This script should be run in an administrative PowerShell console on a SCOM management server. You can run this script using: powershell.exe -executionpolicy unrestricted -command .\MoveAgentSCOMMgmtServer.ps1
How to run:
Step 1: Copy the MoveAgentSCOMMgmtServer.ps1 script to a SCOM management server.
Step 2: Open an elevated PowerShell and navigate to the script. For example: CD “C:\SCOM Scripts”
Step 3: Run powershell.exe -executionpolicy unrestricted -command .\MoveAgentSCOMMgmtServer.ps1
You will be prompted to enter the name of the management server you want the SCOM Agents set to. You need to enter in the servers full FQDN. This can be a management server or a gateway server.
Step 4: A window will pop up with a list of your SCOM Agents. Select the SCOM Agents you want to change the primary management server for. Click the OK button.
Step 5: Once the SCOM Agents are set you should see a similar output.
Download from TechNet Gallery: