SCOM 2012 Hello World !

By | February 27, 2017

I’ve been investigating how to connect to SCOM 2012 through code in order to extract information, and I thought a good first task (therefore a SCOM 2012 Hello World if you will ;)) would be to retrieve the current alerts. I couldn’t find any examples on how to do this, so after some searching came up with the following.

I have used some sample code from Stackoverflow to read in the password for the user and have attributed the code with the source URL below.

The full code is as follows:

Note that if the user’s password has expired and needs to be changed, the SCOM Management Server will reject the connection with an exception, so if you get an error remember to check the domain account manually.

The default resolution state values that are supplied with SCOM are below, though obviously custom ones can be defined in the Administration space.

This project will be uploaded to github shortly (and the location noted).