How to populate object properties with data from a database using PowerShell

You probably know how you can use a registry discovery to populate properties on windows computer instances, but what if you already have the data in SQL database/CMDB and want to avoid having to first write the data to the registry and then use a discovery to get the data into SCOM? Or what if the objects are not windows computers and hence the registry method is not an option?

The solution is to use PowerShell to read the data from the database and then update the objects in SCOM. This post will show you how to do this on distributed applications, but you can of course do on any object type in SCOM.

Here is a screenshot of the details of a distributed application (DA), where I use data from a SQL database (service description, business detailed description, Is business servers, owned by organization and availability schedule).

This method is also great if you need to group your servers by priority, life cycle phase etc for dashboards and alert views. Extend the windows computers class and then use powershell to get the get and write the data to the custom properties.