How to add or remove management group settings in SCOM agent

These days I’m super busy with a SCOM project and came across a dilemma of decommissioning an old SCOM server. The scenario is like below.

  1. SCOM 2012 Installed and agents are already deployed.
  2. Need to decommission same and deploy agents with minimal effort.

Now in order to achieve the second goal I thought whether I can use the same agent that is deployed previously and reassign the management group & server in it. Yes it is possible and if you do that in a GUI way you’ll have to edit Operations Manager Agent (Microsoft Monitoring Agent) settings in Control Panel like this.

MOM Agent Modify

But how can we automate this? Of course you cannot centrally execute a script because once you remove the associate with a management group you will have orphaned agents.

All you have to do is use a VBScript like below and execute it in each agent managed computer.

Option Explicit

Dim objMSConfig
Set objMSConfig = CreateObject(“AgentConfigManager.MgmtSvcCfg”)

‘Remove a management group
Call objMSConfig.RemoveManagementGroup (“MyManagementGroupToRemove”)

‘Add a management group
Call objMSConfig.AddManagementGroup (“MyManagementGroupToAdd”, “ManagementServerFQDN”,5723)

Remember the flow is important. I suggest that you remove the old association first. Once the association is successful give it a day’s rest to connect to the new management group. Once connected you can update the agent via push installation at a later point.

Please refer this TechNet article for the syntax.

Do we have to reboot servers If I uninstall the SCOM Agent rather than update it with new values?

The answer is a big NO. You do not need to reboot monitored servers once you install or uninstall an agent. This applies for SCCM as well. Refer this thread from TechNet forums if you are uncertain.