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.

No comments:

Post a Comment