czwartek, 17 listopada 2016

SCOM Agents Migration to Another Management Group

    During your adventure with System Center Operations Manager you might stumble upon the situation where you will create a brand new SCOM infrastructure just aside the already existing one. It might also happen, that after completing this task you will face one more task - the migration of SCOM agents from old Management Group to the new one. The migration might be completed by running a script on each SCOM client individually - preferably with usage of SCCM deployment. The script contains also random seed in case you would like to, as I did, randomly spread the clients among two SCOM Management Servers. The code ensures 50%/50% division of the load, but it can be adjusted according to needs with a small script modification. The same could be done in case of different number of Management Servers.

Usage:
     Swap the following strings in the script below with the names from your SCOM infrastructure:

  • _NewMGName_ - put the name of your new Management Group (the target one)
  • _OldMGName_ -  put the name of your new Management Group (the target one)
  • _NewMGServerFQDNName_1_ - put the FQDN of the first Management Server in the target Management Group
  • _NewMGServerFQDNName_2_ - put the FQDN of the second Management Server in the target Management Group
     The code has to be saved as a .vbs file and run on the SCOM client either manually or for instance via SCCM deployment

Code:
Option Explicit
On Error Resume Next

Dim objMSConfig
Set objMSConfig = CreateObject("AgentconfigManager.MgmtSvcCfg")

Dim objMGNew
Dim objMGOld

Set objMGNew = objMSConfig.GetManagementGroup ("_NewMGName_")
If Err <> 0 Then
    Randomize
    If Rnd > 0.5 Then
        Call objMSConfig.AddManagementGroup ("_NewMGName_", "_NewMGServerFQDNName_1_",5723)
    Else
        Call objMSConfig.AddManagementGroup ("_NewMGName_", "
_NewMGServerFQDNName_2_",5723)
    End If
End If

Call objMSConfig.RemoveManagementGroup ("_OldMGName_")

Call objMSConfig.ReloadConfiguration

Brak komentarzy:

Prześlij komentarz