Here’s a handy script you can use to add a management group to a server that already has a SCOM agent on.
If you save the below as a VBS (Be sure to edit the Management group and server name in bold)
Set objMSConfig = CreateObject(“AgentConfigManager.MgmtSvcCfg”)
Call objMSConfig.AddManagementGroup (“MGName“, “Servername.test.com“,5723)
Now if you run the VBS script locally on the server with a SCOM agent it will now add the management group.
If you are in a situation where you need to add a management group to multiple servers, you can do this in the following way.
- Download PSEXEC (https://technet.microsoft.com/en-us/sysinternals/bb897553.aspx)
- Place the VBS you saved earlier onto a file share (In this example that will be TestFileServerSCOMMGAdd.vbs)
- Now open command prompt and map to the location where PsExec.exe is located
- Simply Run PsExec.exe Server1,Server2 -s cscript.exe “TestFileServerSCOMMGAdd.vbs” (Change the Server names to the servers you wish to add the management group to, making sure each server name is separated by a comma)
- The Management Group should be added J