In Operations Manager, you can create a script that can add or remove a management group from the agent.
Example
The following is an example script, which is written in VBScript, that adds or removes a management group. For more information about parameters, return values, usage, and errors, see AddManagementGroup Method or RemoveManagementGroup Method.
Option Explicit Dim objMSConfig Set objMSConfig = CreateObject("AgentConfigManager.MgmtSvcCfg") ‘Add a management group Call objMSConfig.AddManagementGroup ("MyManagementGroupToAdd", "company.sm.net",5723) ‘Remove a management group Call objMSConfig.RemoveManagementGroup ("MyManagementGroupToRemove”)