Agent Pending Actions can get out of synch between the Console, and the database

When you look at your agent pending actions in the Administration pane of the console.... you will see pending actions for things like approving a manual agent install, agent installation in progress, approving agent updates, like from a hotfix, etc.


This pending action information is also contained in the SQL table in the OpsDB - agentpendingaction


It is possible for the agentpendingaction table to get out of synch with the console, for instance, if the server was in the middle of updating/installing an agent - and the management server Healthservice process crashed or was killed.


In this case, you might have a lingering pending action, that blocks you from doing something in the future.  For instance - if you had a pending action to install an agent, that did not show up in the pending actions view of the console.  What might happen, is that when you attempt to discover and push the agent to this same server, you get an error message:


"One or more computers 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"



The problem is - they don't show up in this view!


To view the database information on pending actions:

select * from agentpendingaction

You should be able to find your pending action there - that does not show up in the Pending Action view in the console, if you are affected by this.


To resolve - we should first try and reject these "ghost" pending actions via the SDK... using powershell.  Open a command shell, and run the following:


To see a prettier view:

get-agentpendingaction | ft agentname,agentpendingactiontype

To see a specific pending action for a specific agent:

get-agentPendingAction | where {$_.AgentName -eq ""}

To reject the specific pending action:

get-agentPendingAction | where {$_.AgentName -eq ""}|Reject-agentPendingAction

We can use the last line - to reject the specific pending action we are interested in.


You might get an exception running this:

Reject-AgentPendingAction : Microsoft.EnterpriseManagement.Common.UnknownServiceE
xception: The service threw an unknown exception. See inner exception for details
. ---> System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]:
Exception of type 'Microsoft.EnterpriseManagement.Common.DataItemDoesNotExistExc
eption' was thrown.

If this fails, such as gives an exception, or if our problem pending action doesn't even show up in Powershell.... we have to drop down to the SQL database level.  This is a LAST resort and NOT SUPPORTED.... run at your own risk.

There is a stored procedure to delete pending actions.... here is an example, to run in a SQL query window:

exec p_AgentPendingActionDeleteByAgentName ''

Change '' to the agent name that is showing up in the SQL table, but not in the console view.

Comments (16)

  1. paul says:

    Thanks.  This helped me out.  I had to resort to the SQL Query.

  2. David says:

    I couldn’t get the query to run (SQL 2008), but I was able to edit the top 200 rows and manually delete the entry. Great Post.

  3. Chuffie says:

    SQL Query worked for me. Thanks. Took me 2 days to find this!!

  4. Maekee says:

    EXCELLENT POST! It solved my problem i have had for a while now. Thanks alot for a great blog.

  5. Srini says:

    Great post this. I resolved the issue with the SQL query.

  6. Johan E says:

    we had this problem after a failed push and then a manuall installation of the agent. we managed to approve it by changing the 'reject' command to approve-agentPendingAction as:

    get-agentPendingAction | where {$_.AgentName -eq ""} | approve-agentPendingAction

    now it shows upp and is healty with the managed agents.


  7. Robbo says:

    it’s the fix i needed. Tried cache clearing on the console, multiple paths to agent re install but only this database entry delete using the stored procedure fixed it.
    Many thanks

  8. Drew says:

    Kevin: On SCOM 2012 SP1 and Forward powershell command update.PS C:|> Get-SCOMPendingManagement | Where-Object {$_.AgentName -eq “Hostname,com”} | Deny-SCOMPendingmanagement.

  9. Souvick Roy says:

    Thanks Kevin
    Am looking into a solution for last 1 month, Your SQL query save me.

  10. Anonymous says:

    Here are some more links from my private collections. This links are very usefull to administrate, configure

  11. Todd B. says:

    Thanks for this post. In our case, I’m surprised that this is still an issue with SCOM 2012. Because we had over 900 agents in this state, our SQL team made it easy for me to address this. I execute the query, then copy the results in a new query that
    deletes a particular set of servers.

    select ‘exec p_AgentPendingActionDeleteByAgentName ”’ + [AgentName] + ””
    FROM [dSCOMMG1ops].[dbo].[AgentPendingAction]
    Where AgentName like ‘Ad%’

  12. Brandy Reid says:

    This blog helped me out today. Thanks for sharing 🙂

  13. Snigdha Naik says:

    i have received alerts for some linux server agents that heartbeat failed in scom 2012 R2.So how to verify what happened to those agents?what might have happened?what would be the resolution . These agents are successfully installed few months back . The
    failing messages of these agents is like "The System is not responding to heartbeats."Could you please help me out here.

  14. Shashikanth says:

    Thanks for sharing the good info, the below command helped me to approve the agent from pending management
    (get-agentPendingAction | where {$_.AgentName -eq ""}|Approve-AgentPendingAction)

  15. Yanni says:

    Yes, try to delete the pending action on Db tabel "agentpendingaction". It’s work. Thks for sharing

  16. Kevin Holman says:

    If you have a LOT of Agent Pending Actions, and you just want to clear them all:

    DECLARE @AgentName nvarchar(MAX)
    WHILE EXISTS(SELECT TOP(1) AgentName FROM AgentPendingAction)
    SET @AgentName = (SELECT TOP(1) AgentName FROM AgentPendingAction)
    SELECT @AgentName
    EXEC p_AgentPendingActionDeleteByAgentName @AgentName

Skip to main content