OpsMgr: Get Agent-Managed Computer
The other day I needed to get a list of all SCOM 2007 agent-managed computers in my environment, because they needed to have a registry key fixed. I constructed a SQL query to do so:SELECT MEGv.[Displayname] AS Object FROM dbo.ManagedEntityGenericView AS MEGv
INNER JOIN dbo.[ManagedTypeView] AS TMv
ON TMv.[id] = MEGv.[MonitoringClassId]
WHERE TMv.[Name] = 'Microsoft.SystemCenter.HealthService'
ORDER BY MEGv.[Displayname]
I saved the results to a file called "servers.txt". Essentially, it queries the OpsMgr operational DB for any instance of the HealthService class. Enjoy!








