Script to clear off Failed workflows
Thanks
Best Answer
-
Conner_Wood Customer Ninja IT Monkey ✭✭✭✭I never did get around to doing this, however I know you'll need to look into Microsoft.EnterpriseManagement.Subscriptions section.
I assume with C# this would work when referencing the Microsoft.EnterpriseManagement.Core.dll:using Microsoft.EnterpriseManagement; using Microsoft.EnterpriseManagement.Subscriptions; ~~~~~~~~~~~~ EnterpriseManagementGroup emg = new EnterpriseManagementGroup("SCSMSERVER"); IWorkflowSubscriptionBase wfSub = emg.Subscription.GetSubscriptionsByCriteria(new ManagementPackRuleCriteria("Name LIKE '%'")).FirstOrDefault(); //All //IList<SubscriptionJobStatus> wfSubInstances = emg.Subscription.GetSubscriptionStatusById(wfSub.Id.Value); //Failed IList<SubscriptionJobStatus> wfSubFailedInstances = emg.Subscription.GetFailedSubscriptionStatusById(wfSub.Id.Value); //FOR EACH THROUGH THEM AND IGNORE! foreach(SubscriptionJobStatus wfSubFailedInstance in wfSubFailedInstances) { emg.Subscription.IgnoreFailedSubscription(wfSubFailedInstance); }
With PowerShell I know only this
$wfSubs = Get-SCSMSubscription -ErrorAction SilentlyContinue1
Answers
I assume with C# this would work when referencing the Microsoft.EnterpriseManagement.Core.dll:
With PowerShell I know only this