Share This Post

Operations Manager 2007 PowerShell cmdlet reject-agentpendingaction

The reject-agentpendingaction cmdlet rejects the specified agent pending action. Use the get-agentpendingaction cmdlet and pipe its results to the reject-agentpendingaction cmdlet to reject the specified agent pending action. The example in the reject-agentpendingaction help shows how to reject all agent pending actions. What if you only want to reject a specific type of agent pending action type?

When you run get-agentpendingaction cmdlet with no parameters a list like the following will be returned:

image

Let’s find out the properties available to the get-agentpendingaction cmdlet, by piping the get-agentpendingaction cmdlet to the get-member cmdlet.

>get-agentpendingaction | get-member -membertype property

image

The AgentPendingActionType is the property we will want to filter by. I only want to reject AgentPendingActionType that equals RepairFailed. To verify that only the servers that have the AgentPendingActionType that equals RepairFailed are rejected, I will use the –WhatIf parameter after the Reject-Agentpendingaction cmdlet.

>get-agentpendingaction | where-object {$_.AgentPendingActionType -eq "RepairFailed"} | Reject-AgentPendingAction -WhatIf

What if: Performing operation "Reject-AgentPendingAction" on Target "BIODTL.My.Company.Com".

To reject the agentpendingactions just remove the –WhatIf parameter.

>get-agentpendingaction | where-object {$_.AgentPendingActionType -eq "RepairFailed"} | Reject-AgentPendingAction

Share This Post

Leave a Reply