How to find out the health state of object in OpsMgr via Powershell

Facebooktwitterredditpinterestlinkedinmail

recently i had to face some rule which need to output the health state of some Distributed Applications in OpsMgr, I used the Operations Manager module for powershell.. .after long researching I finally built the below code :

$ObjectState = (get-monitoringclass | Where-Object {$_.displayname -eq “Operations Manager Management Group” -and $_.Description -like “This type represents the Operations Manager Management Group.”} |get-monitoringobject).HealthState

You can find the display name and description while running the get-monitoringclass without any parameters, usually, as I have noticed, the Path of the object is equal to the display name.

That’s it, no need to connect the SQL server and run some bizarre queries, just pure powershell scripting.

5 thoughts on “How to find out the health state of object in OpsMgr via Powershell

  1. Hi there to every body, it’s my first visit of this webpage;
    this website contains amazing and truly fine data for readers.

  2. This does not work in scom 2012? I think it needs to be modified There is no command get-monitoringclass

    1. For scom 2012 you should change the commands with scom prefix…
      This code works for 2007 r2… has to be changed for 2012 with the new commands 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *