Agent Pending Management Ghost

One of my clients recently had an issue with SCOM 2012 R2 latest UR. They were trying to install the SCOM agent on a server. It did not work through the console they would receive the following warning:

One or more computer you are trying to manage are already in the process of being managed. Please resolve these issues via the Pending Management view in Administration, prior to attempting to manage them again.”

clip_image001

The server was not displaying under SCOM Console>>Administration>>Pending Management. They installed the SCOM agent manually but it still did not show in SCOM Console>>Administration>>Pending Management. I jumped into PowerShell and ran the following:

Get-SCOMPendingManagement | ft AgentName,AgentPendingActionType

Output:

clip_image002

NOTE: You can also run this query “select * from agentpendingaction” against the OperationsManager database to see a list of agents in a pending state.

I ran

Get-SCOMPendingManagement | where {$_.AgentName -Like “SERVERNAME.SERVERDOMAIN.com”} | Deny-SCOMPendingManagement

It gave this error:

clip_image003

I then ran:

Get-SCOMPendingManagement | where {$_.AgentPendingActionType -eq “ManualApproval”} | Deny-SCOMPendingManagement

This gave the same error. I then ran Get-SCOMPendingManagement | where {$_.AgentName -Like “SERVERNAME.SERVERDOMAIN.com”} and this worked fine. So PowerShell was not helping me here except for showing me some servers are in the pending state even though they do not show in the console.

To resolve this issue I was able to fix this by removing the stuck agents in SQL. To do this I ran the following stored procedure (blog on this here) against the OperationsManager database:

exec p_AgentPendingActionDeleteByAgentName ‘SERVERNAME.SERVERDOMAIN.com’

After that I ran

Get-SCOMPendingManagement | ft AgentName,AgentPendingActionType in PowerShell again and the server was no longer listed.

I then went back to SCOM Console>>Administration>>Pending Management and now the server shows as pending. I clicked Approve and the SCOM agent was fine after that.

clip_image004

Print Friendly, PDF & Email

Leave a Reply