Agents Pending Mangement using PowerShell

I don’t know about you but I hate it when I have agents stuck in pending management…because, well they aren’t being managed and there’s no monitoring going on. So here’s a short PowerShell script to list all of your Pending Management Agents.

$pushInstall = $repairAgent = $ManualApproval = $RepairFailed = $PushInstallFailed =0

“Pending Management Stats”
“==========================================”
$agentpending = Get-AgentPendingAction
switch ($agentpending | Select-Object AgentPendingActionType ) {
 {$_.AgentPendingActionType -like “PushInstall”} {$pushInstall++}
 {$_.AgentPendingActionType -like “PushInstallFailed”} {$PushInstallFailed++}
 {$_.AgentPendingActionType -like “ManualApproval”}  {$ManualApproval++}
 {$_.AgentPendingActionType -like “RepairAgent”} {$repairAgent++}
 {$_.AgentPendingActionType -like “RepairFailed”} {$RepairFailed++}


“Push Install ……………….. = $pushInstall”
“Push Install Failed …………. = $PushInstallFailed”
“Manual Approval……………… = $ManualApproval”
“Repair Agent ……………….. = $repairAgent”
“Repair Failed ………………. = $RepairFailed”

 

This script will produce output like this:

 

Pending Management Stats
==========================================
Push Install ……………….. = 0
Push Install Failed …………. = 0
Manual Approval……………… = 5
Repair Agent ……………….. = 0
Repair Failed ………………. = 2

 

 
Comments

No comments yet.

Leave a Reply