Last active
February 9, 2016 11:44
-
-
Save kmhuglen/71ad3f307dfdd976d5a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define query criteria | |
$Class = Get-SCSMClass Microsoft.SystemCenter.Orchestrator.RunbookAutomationActivity$ | |
$InProgress = (Get-SCSMEnumeration ActivityStatusEnum.Active).id.guid | |
$Yesterday = (get-date).AddDays(-1) | |
$cType = "Microsoft.EnterpriseManagement.Common.EnterpriseManagementObjectCriteria" | |
$cString = "Status = '$InProgress' and LastModified > '$yesterday'" | |
$crit = new-object $cType $cString,$Class | |
# Get activities | |
$Activities = Get-SCSMObject -criteria $crit | |
# List out all activities | |
$activities | select Id,Title,LastModified | |
# Set activity status to ReRun | |
$activities | Set-SCSMObject -Property Status -Value "ActivityStatusEnum.ReRun" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment