SCOM Task to Add or Remove Management Groups on Agents
A customer of mine found that they had numerous SCOM Agents which were multi-homed to defunct Management Groups, and they were looking for an easy way to remove these old Management Groups from the Agents. They were also building out a new pre-production environment and would need to multi-home some of the production agents to it.
I put together a Management Pack that does the following
- Creates a new class named "Agent Management Groups"
- Runs a discovery on all Agents to discover each Management Group they are configured to connect to
- Provides tasks to Add and Remove Management Groups on the Agents
To use this Management Pack
- Import the Management Pack
- Wait a little while for the Discovery to happen
- Go to the Agent Management Groups\Agents view in the SCOM Console to see the list of Agents and the Management Groups they are configured to communicate with.
- Use the Agent Management Group Tasks in the Tasks pane to Add or Remove Management Groups.
NOTE: Running these task)s will restart the Microsoft Monitoring Agent (Health Service on the Agent. I have seen occasional cases where the service stops and does not start back up. In these cases, you will need to remotely connect to the Agent (or log on to it) and start the service.
Add a Management Group to Agents
Select the Agents to modify, then select the “Add a Management Group” task
In the “Run Task” window, select “Arguments” and click on Override.
Enter the Management Group name and Management Server name in the Arguments override
Run the task
When the task completes successfully, you should need the new Management Groups on the Agents within 5 minutes (when the discovery runs again)
Remove a Management Group from Agents
Let’s say you have decommissioned a Management Group (MG1), but several agents are still configured to use it.
Simply enter MG1 in the search bar to find all Agents that are configured with to connect to that Management Group, select all of them (CTRL—A), and select the "Remove a Management Group" task.
Override the Arguments parameter and enter the name of the Management Group to remove, then run the task
Within a few minutes, you should see the Management Group removed from the view.
A third Task is also included – “Remove all but one Management Group”. In this task, you override the Arguments parameter with the name of the Management Group that you want to KEEP, and all others will be removed.