We’re rolling out a new SCOM environment, and I need to migrate/multi-home agents between our existing management group and the new one. Is there a good way of doing this without manually logging on and modifying the MG settings on each agent? Arrrgghhh, help please!
Were going through the same exercise and this was a great help indeed…
it’s 2017, you don’t log in interactivly any more do you? 🙂
You can add management group through the agent using powershell, and this powershell script could be added as a agent task within SCOM which makes you add the new MG from the console. Below is a PS script function to do it, but it wont be a task straight out of the box.
Adding management group to agent
Adding first or additional management group to agent. for example use this to multihome agent when migrating to a new management group.
Add-SCOMManagementGroup.ps1 -ManagementServer SCOM01.domain -MGMTGroupName SCOMMG
Adds SCOMMG to the agent and set SCOM01 as primary management server. Default port 5723
Add-SCOMManagementGroup.ps1 -ManagementServer [Primary MS] -MGMTGroupName [Management group name] -port [INT]
Adds SCOMMG to the agent and set SCOM01 as primary management server and set port you specify
Author: Martin Ehrnst /Intility AS
[int]$Port = "5723"
Write-Warning "This will restart the agents health service"
#Adding MG to the agent
$Agent = New-Object -ComObject AgentConfigManager.MgmtSvcCfg
$Agent.AddManagementGroup("$MGMTGroupName", "$ManagementServer", "$Port")}
Write-host "An error occured please se exeption message:"
get-service HealthService | Restart-Service
Write-Host "Agent connected to the following management groups"
Also, a little info on the Agent task ‘issue’
I had a read through this as we have recently done the exact same thing for a global customer.
Basically you can use SCOM to give you all the information by creating as simple Management Pack. First create an Attribute. The Attribute (Extend the Computer Class) looks at the registry and then populates a view (New View with Extended Class as property) and with this view you are able to easily see which machines are multihomed or compliant in relation to you new and old Management Group.
Then build a task (VBScript – old school :D) that adds the additional configuration into the registry. I prefer this way as when running PowerShell scripts, there is an execution policy that can catch you out. Then when you have the view sorted into the machines that require the new Management Group, select them all and simply run the task. This will add the Management Group to all the non-compliant machines.
Actually, ignore getting it from me. Jimmy Harper has your solution here. I must have copied it from him. All kudos for the solution must go to him:
Is it no longer as easy as running the discovery from the new MG’s console and “installing” the agent (adding MG info) that way?