Find User Created vCenter Alarms with PowerCLI

I have been doing a bunch of work with vCenter Alarms this past week or so and I have found a pretty neat way to find the Alarms that have been created by users. Or it’s possible everyone already knows this little trick and I am just last to figure it out, either way let’s dig into real quick.

In a new script I have been working on(probably post about that one next week), I realized any alarm I created was spawned with an alarm Id of over 100 (OVER 9000!!!! DBZ Joke).

Alarms

Once I noticed this I created some more alarms and tested against a couple different vCenter instances to make sure I wasn’t crazy.

Here is the one-liner:

get-alarmdefinition | Where-Object {[INT]$_.id.split(“-“)[2] -gt 99}

So let’s do a screenshot of it in action…

UserAlarms

I think it is a pretty neat way to find alarms users have created, and hopefully it is helpful.

Have a great Friday!

One Response to Find User Created vCenter Alarms with PowerCLI

Leave a Reply