Here’s one more Knowledge Base article we published today. This one talks about how to remove orphaned SCOM 2007 agents using PowerShell:
=====
SymptomIn a System Center Operations Manager 2007 R2 Command shell, you may see agents that are still in a pending management state even though they do not appear under pending management in the Operations Manager console.
CauseThis can occur if there are agent records left behind in the Operations Manager database. At some point these agents were deployed to a management server manually but later that management server was decommissioned and the agents were never properly removed.
ResolutionFollow the steps below to resolve this issue.
In this example we assume we have two agent systems named Agent1.contoso.msft and Agent2.contoso.msft. Both agents were assigned to a management server named ManagementServer.Contoso.msft that no longer exists. In your environment you would substitute the names for your specific agents and management server.
AgentName : Agent1.contoso.msft
ManagementServerName : ManagementServer.Contoso.msft
AgentPendingActionType : PushInstallFailed
LastModified : <date/time>
ManagementGroup : Opsmgr-Group
ManagementGroupId : 888a2cd4-0db6-f669-32f8-5b08aa25d2e2
AgentName : Agent2.contoso.msft
ManagementServerName : ManagementServer.Contoso.msft
AgentPendingActionType : PushInstallFailed
LastModified : <date/time>
ManagementGroup : Opsmgr-Group
ManagementGroupId : 888a2cd4-0db6-f669-32f8-5b08aa25d2e2
NOTE Before executing any query against the Operations Manager database be sure that a complete and current backup exists.
-Run the following queries
SELECT AgentPendingActionId
FROM AgentPendingAction WHERE AgentName like 'Agent1.contoso.msft'
Result:
2A5C2E8F-2AD4-1703-D3BE-4755DF1A8E2E
SELECT AgentPendingActionId
FROM AgentPendingAction WHERE AgentName like 'Agent2.contoso.msft'
Result:
360DB30E-3C2C-50A9-B047-A123A87280C0
Execute QUERY:-
DECLARE @ActionId uniqueidentifier
SET @ActionId = (SELECT AgentPendingActionId
FROM AgentPendingAction WHERE AgentName like 'Agent1.contoso.msft')
EXEC p_AgentPendingActionDeleteByIdList @AgentPendingActionIdList = @ActionId
-Record is deleted successfully.
Do the same for the second agent as well.
Now via powershell we can confirm no records exist for these two systems.
Following command will show us each agent and its assigned primary and failover management server via powershell.
get-agent|ft -a ComputerName,primarymanagementservername,@{l="secondary";e={$_.getfailovermanagementservers()|foreach{$_.name}}}
=====
For the most current version of this article please see the following:
2626752 : Removing orphaned Operations Management agents using PowerShell
J.C. Hornbeck | System Center & Security Knowledge Engineer
Get the latest System Center news on Facebook and Twitter :
App-V Team blog:
http://blogs.technet.com/appv/
ConfigMgr Support Team blog:
http://blogs.technet.com/configurationmgr/
DPM Team blog:
http://blogs.technet.com/dpm/
MED-V Team blog:
http://blogs.technet.com/medv/
Orchestrator Support Team blog:
http://blogs.technet.com/b/orchestrator/
Operations Manager Team blog:
http://blogs.technet.com/momteam/
SCVMM Team blog:
http://blogs.technet.com/scvmm
Server App-V Team blog:
http://blogs.technet.com/b/serverappv
Service Manager Team blog:
http://blogs.technet.com/b/servicemanager
System Center Essentials Team blog:
http://blogs.technet.com/b/systemcenteressentials
WSUS Support Team blog:
http://blogs.technet.com/sus/
The Forefront Server Protection blog:
http://blogs.technet.com/b/fss/
The Forefront Endpoint Security blog :
http://blogs.technet.com/b/clientsecurity/
The Forefront Identity Manager blog :
http://blogs.msdn.com/b/ms-identity-support/
The Forefront TMG blog:
http://blogs.technet.com/b/isablog/
The Forefront UAG blog:
http://blogs.technet.com/b/edgeaccessblog/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.