Created
September 10, 2018 18:00
-
-
Save tylergohl/8594fbfeaeb7c9d48b8b1a11a9a20100 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
# Find automation runs that have happened in the last 24 hours and the instances that they have run against | |
$Instances = (Get-SSMAutomationExecutionList | where-object { $_.DocumentName -like '*ssm-nightlyrecycle-doc*' -and $_.ExecutionStartTime -gt (Get-Date).AddHours(-24) } | Get-SSMAutomationExecution).Parameters | |
$InstanceIDs = ((Get-SSMAutomationExecutionList | where-object { $_.DocumentName -like '*ssm-nightlyrecycle-doc*' -and $_.ExecutionStartTime -gt (Get-Date).AddHours(-24) } | Get-SSMAutomationExecution).Parameters).Values | |
$Instances = ($InstanceIDs | Get-EC2Instance | Select-object -ExpandProperty Instances) | |
(($Instances.tag) | Where-Object Key -eq "Name").value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment