SCOM 2012: Approve pending agents through PowerShell

If you install your SCOM 2012 agents manually or through a software deployment service like SCCM then you probably have set the approve pending management setting. With this you can decide when the agent is ready to get added to SCOM.

I recently had an agent that was not populating correctly in the pending management view in SCOM. It showed up one time shortly, but when I tried to approve it, I got an error and the system was gone. I even could not see the error correctly because it was directly gone after it appeared. It was really strange, I checked everything (DNS, ports, logs, reinstalled agent), but all looked normal. As if only the approval was missing.

You can check which agents are in pending management with this SQL query (run on OperationsManager database):
select * from agentpendingaction

One thing helped to solve the problem. That was PowerShell.

The cmdlet Get-SCOMPendingManagement provides you all agents which are in pending management and with Approve-SCOMPendingManagement you can approve the agent you need to.

So open the Operations Manager Shell and enter:
Get-SCOMPendingManagement | where {$_.AgentName -eq “ServernameFQDN“} | Approve-SCOMPendingManagement

Published by

SNtipps

* 1974, female, working as a Consultant. Main topics: MS System Center, ServiceNow. Twitter: @SN_Tipps

5 thoughts on “SCOM 2012: Approve pending agents through PowerShell”

  1. This is Amazing Post we were searching solution for this 20000 events couldnot find better solution other than this , Many Thanks Opsmgrtipps

    1. Hi,
      you can write a script with the cmdlet get-scompendingmanagement, like:
      $csv=get-content c:\temp\approve.csv
      $agents=get-scompendingmanagement
      foreach ($agent in $agents)
      {
      if ($agent.displayname in $csv)
      {
      $agent|approve-scompendingmanagement
      }
      }
      Regards,
      Natascia

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s