PowerShell List all Object Discoveries targeted to Windows Servers

I’m currently trying to find a way to automatically create overrides for Object Discoveries targeted to Windows Servers. More to come soon I hope ;-)

But before doing that I wanted to find all Object Discoveries targeted to Windows Server first. And with the help of some PowerShell friends (first Jeremy Pavleck then Marco Shaw) I was able to find a way to do that with PowerShell.

Just open the OpsMgr Command Shell and run the next command. (change the class if you want to).

# Enumerate OpsMgr 2007 Object Discoveries targeted to Windows Server
# Date: 13/10/2008
# Author: Stefan Stranger (help from Jeremy Pavleck and Marco Shaw)

# Cory Delamarter (increased speed)
get-discovery |? {$_.Target -match (get-monitoringclass | where {$_.Name -eq "Microsoft.Windows.Server.Computer"}).Id} | select Name, DisplayName

get-discovery | ? {$_.Target -match $(get-monitoringclass -Name "Microsoft.Windows.Server.Computer").Id} | ft Name, DisplayName

You can download the script from the PowerShell Code Repository.