Showing posts with label Information. Show all posts
Showing posts with label Information. Show all posts

Thursday, January 31, 2013

[OpsMgr 2007 R2][OpsMgr 2012] Get Rule/Monitor full information from Rule/Monitor name - Powershell script



Today, I've had a request to retrieve all informations for a rule that was generating too much alerts. The rule was give, by it's name and the name was not really user friendly : _08C092E8_FD6F_48b2_BA1E_473C3B84A2F3_.RaiseAlert

Thanks to the Exchange Server 2010 Management pack developper team :)

So I've create a short powershell function to add to my powershell profile :

  1. Function RuleInfo  ([string]$RuleName)
  2. {
  3. get-rule | where {$_.Name -eq $RuleName} | select-object @{Name="MP";Expression={ foreach-object {$_.GetManagementPack().DisplayName }}}, @{Name="MP Version";Expression={ foreach-object {$_.GetManagementPack().Version }}}, Name, DisplayName, XmlTag, Enabled, Category, Target, ConfirmDelivery, Remotable, Priority, DiscardLevel, ConditionDetection, DataSourceCollection, WriteActionCollection, Id, Description, Comment, Status, LastModified, TimeAdded
  4. }
Then I've launch it in my powershell console using the line :

RuleInfo  _08C092E8_FD6F_48b2_BA1E_473C3B84A2F3_.RaiseAlert

Result is like :



 Well done ! :)


I've also created the same function for monitors :

  1. Function MonitorInfo  ([string]$MonitorName)
  2. {
  3. get-monitor | where {$_.Name -eq $MonitorName} | select-object @{Name="MP";Expression={ foreach-object {$_.GetManagementPack().DisplayName }}}, @{Name="MP Version";Expression={ foreach-object {$_.GetManagementPack().Version }}}, Name, DisplayName, XmlTag, Enabled, Category, Configuration, Id, ConfirmDelivery, OperationalStateCollection, Target, ParentMonitorID, Remotable, Priority, RunAs, AlertSettings, Accessibility, Description, LanguageCode, Comment, Status, LastModified, TimeAdded
  4. }
Have fun !

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

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.

Friday, January 13, 2012

[Powershell] Get Rules information or Monitors information for all MP in SCOM

Here is a short powershell command to list in a .CSV file Rules information for all SCOM MP using a powershell script :

Get Rules Informations :
  1. get-rule | select-object @{Name="MP";Expression={ foreach-object {$_.GetManagementPack().DisplayName }}}, @{Name="MP Version";Expression={ foreach-object {$_.GetManagementPack().Version }}}, Name, DisplayName, XmlTag, Enabled, Category |
    sort-object -property MP | export-csv "C:\Allrules-MyMgtGroupName.csv"
Get Monitors Informations :
  1. get-monitor | select-object @{Name="MP";Expression={ foreach-object {$_.GetManagementPack().DisplayName }}}, @{Name="MP Version";Expression={ foreach-object {$_.GetManagementPack().Version }}}, Name, DisplayName, XmlTag, Enabled, Category, Configuration  | Sort-object -property MP | export-csv "C:\AllMonitors-MyMgtGroupName.csv"
 With the same way, you can imagine listing all classes for all MP : see http://tetris38.blogspot.com/2012/01/powershell-get-classes-information-for.html

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

[Powershell] Get classes information for all MP in SCOM

Here is a short powershell command to list in a .CSV file all classes information for all SCOM MP using a powershell script :

  1. get-monitoringclass | select-object @{Name="MP";Expression={ foreach-object {$_.GetManagementPack().DisplayName }}}, @{Name="MP Version";Expression={ foreach-object {$_.GetManagementPack().Version }}}, Name, DisplayName, Id, Abstract, Accessibility, Base, Comment, Description, Hosted, LanguageCode, LastModified, ManagementGroup, ManagementGroupId, PropertyCollection, Singleton, Status, TimeAdded, XmlTag  |  sort-object -property MP | export-csv "C:\AllClasses-MyMgtGroupName.csv"

In my case this is usefull to determine what are the Name + ID for all classes for a specific MP to configure monitoring instructions in a tool.

With the same way you can export Rules and Monitors information for all your MP : http://tetris38.blogspot.com/2012/01/powershell-get-rules-information-or.html

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