SCOM2007: Determine Agent From Health Service ID
Posted by Jeremy on May 16th, 2008
System Center Operations Manager 2007 is great, don’t get me wrong. But it does have it’s oddities - and one of those are messages such as these:
Details:Health service ( A63BAA7B-20B1-D6C0-75B9-8A8CE3DD7E02 ) should not generate data about this managed object ( 021971E6-1EFB-E123-7E2A-452ADB511016 ).
Now, we know that Health Service ID is referring to a specific agent, but which one? Luckily, this is fairly easy to figure out. Just hop onto the database server and run the following query:
-
SELECT DisplayName FROM BaseManagedEntity WHERE BaseManagedEntityId = ‘THE ID’
It should return the DisplayName property of said ID, which is the agent you’re looking for.
In fact, to go a step further - if you have many queries like this, you could write a PowerShell function to simplify things for you - here’s a real rough outline:
-
function Get-AgentByHSID ([string]$hsid)
-
{
-
$omdbserver = "<Set Your DB Name Here>"
-
$omdb = "OperationsManager"
-
-
$cn = new-object system.data.SqlClient.SqlConnection("Data Source=$omdbserver;Initial Catalog=$omdb;Integrated Security=SSPI;");
-
$ds = New-Object "System.Data.DataSet" "AgentName"
-
$q = "Select DisplayName from BaseManagedEntity where BaseManagedEntityId = ‘$HSID’"
-
$da = new-object "System.Data.SqlClient.SqlDataAdapter" ($q, $cn)
-
$da.Fill($ds)
-
Write-Host "HSID $HSID is associated with the following agent:"
-
$ds.tables
-
}
Like I said, the script is fairly basic and assumes a trust relationship with the database. It also expects a valid HSID - I’ll clean it up later. Edit the script, entering in your SCOM DB and DB Name if necessary, then add it to your $PROFILE. Then it’s as simple as Get-AgentByHSID “long health service guid” and it does all the heavy lifting.




