question

rudreshmasaraddi-5591 avatar image
0 Votes"
rudreshmasaraddi-5591 asked AlexZhu-MSFT commented

Powershell script to remove only the primary management server and new primary management server under the agent control panel --"microsoft monitoring agent "

Hi All,


We have noticed couple of scom agent server had wrong reporting primary management server in the control panel-microsoft monitoring agent.
Kindly help us with powershell script to update the primary management server in control panel .

Note - management group should be same

msc-operations-manager
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AlexZhu-MSFT avatar image
0 Votes"
AlexZhu-MSFT answered AlexZhu-MSFT commented

Hi,

For this query, we can remove the existing management group and add new one using the similar powershell script.

Note: we need change the script to cater for the real environment, for example, the mangement group name, the primary management server, etc.

     $mma1 = New-Object -ComObject 'AgentConfigManager.MgmtSvcCfg'
     $mma1.RemoveManagementGroup('test02')
     if ($? -eq 0)
     {
         write-host "management group test02 was removed!"
     }
     $mma1.RemoveManagementGroup('test01')
     if ($? -eq 0)
     {
         write-host "management group test01 was removed!"
     }
     $mma1.AddManagementGroup('test03' , 'om22.sc.com' , 5723)
     if ($? -eq 0)
     {
         write-host "management group test03 was added!"
     }
     $mma1.ReloadConfiguration()

screenshot from the lab test before the script is run

140640-scom-management-group-01.png

screenshot from the lab test after the script is run

140695-scom-management-group-02.png

Alex
If the response is helpful, please click "Accept Answer" and upvote it.



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,

How's everything going? Have we figured out this problem? Or is there any other assistance that we can provide?

Regards,

Alex
If the response is helpful, please click "Accept Answer" and upvote it.

0 Votes 0 ·