24 Mar 2011

SCOM 2007 R2 Manually installed agents

Sometimes it is needed to change status of manually installed agents in SCOM. 
This change(to "automatically installed") gives possibilities to auto-update agents in future, repair, uninstall and to change/add management server/failover server.




Getting list of all manually installed agents(Powershell):


Get-Agent | where {$_.ManuallyInstalled -match ‘true’} | ft name,ManuallyInstalled
Getting list of all manually installed agents(SQL query for DB):

SELECT bme.DisplayName FROM MT_HealthService mths 
INNER JOIN BaseManagedEntity bme ON bme.BaseManagedEntityId = mths.BaseManagedEntityId 
WHERE IsManuallyInstalled = 1

IsManuallyInstalled field is for installation status of an agent. We can change with the following query: 


UPDATE MT_HealthService
SET IsManuallyInstalled=0 

WHERE IsManuallyInstalled=1

Changing the status of a direct agent:

UPDATE MT_HealthService 
SET IsManuallyInstalled=0 
WHERE IsManuallyInstalled=1 
AND BaseManagedEntityId IN 
(SELECT BaseManagedEntityID FROM BaseManagedEntity 
WHERE BaseManagedTypeId = ‘XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX′
AND DisplayName = ‘agentname.domain.local’)

2 comments:

  1. This rocks!!
    Thankyou for the great timesaver scripts. Is proving very helpful in preparation for upgrade to OpsMgr 2012.
    JB

    ReplyDelete