Archive

Posts Tagged ‘PowerShell’

Get a list of monitored URLs out of SCOM via PowerShell

December 18, 2013 4 comments

Our URL monitors, imported using the BulkURL utility for SCOM have display names that contain the text URL.  The names of the monitors containing URL are unique and contain a list of SEVERAL urls being watched.  For example we have one monitor for SharePoint, which contains several URL’s of sharepoint sites, and another called SharePoint2 that contains several more URL’s.  The point is, you are going to query for the name of your parent monitor, then you can get all the URL’s that are contained in that parent monitor.

Find URL monitors if URL is in the monitor display name:

get-monitoringclass | where {$_.DisplayName -like “*URL*”} | FT Name

This will return only GUIDS, if created in console.  To get the display name you need to execute this:

get-monitoringclass | where {$_.DisplayName -like “*URL*”} | FT Name, DisplayName

Now from the list find the GUID and the display name of the actual monitor, not watcher node:

WebApplication_f1cea1da6eab40e4a7c27d0f6141cdfe

WebApplication_e6a8be62bd1d448ea4787284d0df5a8c

WebApplication_dce99aee7c924d24a01d9df7532162f7

WebApplication_a34f8e5f51ac45558146e7a53ba1797b

From those guids, you can now run the following command and dump a list of URLS:

get-monitoringobject -monitoringclass (get-monitoringclass -Name WebApplication_a34f8e5f51ac45558146e7a53ba1797b) | Select-object DisplayName | export-csv “My Location”

From what I could tell there are many ways to get urls into SCOM, but nothing out of the box to dump the monitors out of SCOM.  Powershell, of course is probably one of the best and fastest ways to achieve this.  Hat tip to Charles Champion for working with me on this.