Showing posts with label Management Group. Show all posts
Showing posts with label Management Group. Show all posts

Wednesday, January 30, 2013

[OpsMgr 2012] How to Display Management Group Information - VBS Script

Updated: January 31, 2012
Applies To: System Center 2012 - Operations Manager





In Operations Manager, you can create a script that can retrieve a management group or a collection of management groups from the agent.

Example

The following is an example script, which is written in VBScript, that displays information about management groups. For more information about parameters, return values, usage, and errors, see GetManagementGroups Method or GetManagementGroup Method.
 
  1. Option Explicit
  2. Dim objMSConfig
  3. Set objMSConfig = CreateObject("AgentConfigManager.MgmtSvcCfg")
  4. 'Get a management group and display the server name
  5. Dim objMG
  6. Set objMG = objMSConfig.GetManagementGroup ("MyManagementGroupToGet”)
  7. MsgBox  objMG.ManagementGroupServer
  8. 'Get all management groups and display the port
  9. Dim collMG
  10. Set collMG = objMSConfig.GetManagementGroups()
  11. 'Enumerate the collection
  12. Dim mgItem
  13. For Each mgItem In collMG
  14.    MsgBox CInt(objMG.ManagementServerPort)
  15. Next

This posting is provided "AS IS" with no warranties.

[OpsMgr 2012] How to Add and Remove a Management Group - VBS Script

Updated: January 31, 2012
Applies To: System Center 2012 - Operations Manager



In Operations Manager, you can create a script that can add or remove a management group from the agent.

Example

The following is an example script, which is written in VBScript, that adds or removes a management group. For more information about parameters, return values, usage, and errors, see AddManagementGroup Method or RemoveManagementGroup Method.
 
 
 
  1. Option Explicit
  2. Dim objMSConfig
  3. Set objMSConfig = CreateObject("AgentConfigManager.MgmtSvcCfg")
  4. ‘Add a management group
  5. Call objMSConfig.AddManagementGroup ("MyManagementGroupToAdd", "company.sm.net",5723)
  6. ‘Remove a management group
  7. Call objMSConfig.RemoveManagementGroup ("MyManagementGroupToRemove”)

This posting is provided "AS IS" with no warranties.