Find and Stop Azure Automation Suspended Jobs

In this post, I have provided a PowerShell script to find jobs using the Update Management automation patching scripts, and stop suspended jobs.

$SuspendedJobs = Get-AzAutomationJob -Status Suspended -ResourceGroupName $AutomationAccountRG -AutomationAccountName $AutomationAccountName | where {$job.RunbookName -match "Patch" }
$SuspendedJobs
Foreach($Job in $SuspendedJobs)
{
Stop-AzAutomationJob -Id $job.JobId -ResourceGroupName $AutomationAccountRG -AutomationAccountName $AutomationAccountName
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu