Username: Password:
 | Register
Home
System Center Forum
  • News
  • Articles
  • How To Guides
  • Downloads
  • Frequently Asked Questions
  • Links
  • Events
  • Contact Us

OpsMgr 2007: Exploring your discovered inventory with the Command Shell



  Posted by: Pete
  Categories: News, Operations Manager 2007, Powershell, Tips -n- Tricks

In the previous Powershell Tip, you can see that it’s quite easy to enumerate the object classes present in your Operations Manager 2007 environment. You may be surprised to learn it’s equally simple to take this example one step further to enumerate the discovered instances of a given object class.
Using a similar one-liner to the previous tip, we can use get-monitoringclass cmdlet to retrieve a list of the discovered object classes, like so:

get-monitoringclass | select-object DisplayName, Name, Description | export-csv -path c:\classes.csv

We can then find the Name column in this output (not to be confused with DisplayName) to retrieve a list of discovered instances of the object class of our choice by passing output of the get-monitoringclass cmdlet for a single class to the get-monitoringobject cmdlet, as illustrated for the ‘SQL 2005 DB’ object class below:

get-monitoringclass -name “Microsoft.SQLServer.2005.Database” | get-monitoringobject

And using the format-table cmdlet demonstrated in several past examples, we can filter and format results in a neatly organized tabular format, so display only the database DisplayName (e.g. OperationsManager) and PathName, which represents the server and SQL instance that hosts the database.

get-monitoringclass -name “Microsoft.SQLServer.2005.Database” | get-monitoringobject | ft DisplayName, PathName

The resulting output of the PathName is a bit messy, but you can spot the host server and SQL instance name (MSSQLSERVER is the default SQL instance).

DisplayName        PathName
———–                ——–
msdb                         OPSMGR.contoso.com%003bMSSQLSERVER%003amsdb

In the next installment, we’ll take a short look at a special object class…groups

One Response to “OpsMgr 2007: Exploring your discovered inventory with the Command Shell”

  1. System Center Forum - OpsMgr 2007: Exploring discovered inventory with the Command Shell – Groups Says:

    […] OpsMgr 2007: Exploring your discovered inventory with the Command Shell […]

Leave a Reply

You must be logged in to post a comment.


Privacy Policy | Terms of Use | © 2005-2007 Pete Zerger