How to expire pending tasks in ARS 6.7

There were many requests to add the ActiveRoles Server pending approval tasks autoexpiration feature. So, as we know, it will be a part of the ActiveRoles Server 6.8. But it also can be done in the ActiveRoles Server 6.7.

For example, we want all tasks created more than 30 days ago to be canceled.

We can create the scheduled task, using the script below:

$Date=(Get-Date).AddDays(-30)​

Get-QARSApprovalTask -TaskStatus Pending -Proxy -CreatedBefore $Date | %{Reject-QARSApprovalTask -Task $_ -Reason Expired}

Remember that one operation can produce many tasks. On screenshot below I have 7 tasks for 2 operations and if I reject one task, others tasks for the same operation will be rejected..

So, in this case, script may return some errors, but it will work anyway.

About the Author