Putting ALL root class objects in maintenance mode

Andrew Perry 1 Reputation point
2021-02-01T17:54:13.137+00:00

Hi,

We currently have a script that puts the "Windows Computer" object in to Maintenance Mode.

Whilst this does the job 99% of the time, there are occasions where there are objects that do not currently inherit from Windows Computer and therefore still generate alerts.

I am trying to find a way how I can get the highest root object (such as Windows Computer) for each monitored object that generates the alert, so that I can put all of the root classes in to Maintenance Mode (and select the ...and all contained objects)

So far, I can only think to start off by doing a search with Get-SCOMMonitoringObject specifying a wild card for the server name as the DisplayName. This does indeed pull back all monitored objects with such name in it, as I would expect.

But I don't want to put all these in to a schedule as the majority of them would already be covered by putting Windows Computer (and all contained objects) in MM.

So my challenge, and question is how can I strip out the list of monitoring objects returned, return a unique list and then get the top level class of each monitoring object. Ultimately ending up with a list of root class objects for the server that I can then place each in MM?

I have seen this from Jonathon (find-base-class-hosting-class-and-all-properties-using-powershell) but I am struggling to put all this together.

I know there is a InMaintenanceMode property, where I could find all objects not in Maintenance Mode, but that doesn't help me at creation time when none of them will be in MM yet.

Operations Manager
Operations Manager
A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.
1,413 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,362 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. CyrAz 5,181 Reputation points
    2021-02-01T18:16:26.09+00:00

    I think that trying to create a universal script for this is a bit of a lost cause... it's likely that some (most?) of the objects that are not contained/hosted by the computer don't even contain the computer name in their display name :/

    0 comments No comments

  2. Andrew Perry 1 Reputation point
    2021-02-01T18:47:06.51+00:00

    Well the monitoring object does contain it. If it didn't, I would simply go back and tell them that it is not identifiable by the server name. But unfortunately these are.

    Admittedly, as I mentioned, it is just the 1% but the end goal of all this is to automate Maintenance Mode, but I cannot expect the support teams to understand the make up of the hierarchy and know what objects to request to put in MM. As far as they are concerned, they don't want any alerts that mention the server. I need to be able to take a server name (as that is all they need to know for their side) and then put any object related to that server in to MM.

    A specific example we have is with MS Dynamics which consists of many different objects such as cluster, Availability Groups, SharePoint Farms, Database Objects. Some of these are covered under Windows Computer, but some, such as the cluster groups are not.

    I could manually build up a list of root classes I suppose and check at runtime if the object exists for such root class, but just trying to make it dynamic and only add objects that part of that server. But the big thing is that I am trying to just arrive at the top level of those to avoid putting objects in MM that are already covered by a root class.

    I will keep playing and will update if I come across anything.

    Thanks for your response

    Andrew

    0 comments No comments