I was having to do a few manual agent installs recently and when i went into the console to approve them it errored and threw me out. When I went back into the console and the server was not in the agent managed secion, so i went into pending management to do the approval again but then agent had disappeared.So a quick powershell command to check the pending agents Get SCOMAgentPending
The command outputted my agent sitting there in ManualApprovalSo time for a little more PowerShell to approve the pending agent,
Get-SCOMPendingManagement | where {$_.AgentName -eq “ServernameFQDN“} | Approve-SCOMPendingManagement
If you need to approve all agents that are pending you can use the following
Get-SCOMPendingManagement | where {$_.PendingAction -eq “ManualApproval“} | Approve-SCOMPendingManagement