$Servers = Get-EC2Tag -Region us-east-2 | ? { $_.ResourceType -eq "Instance" -and $_.Key -eq "Name" } | select -expand Value $a =@("$Servers,") # Name of servers to be restarted ForEach($Servers in $a) { $instanceID = Get-EC2Instance -Region us-east-2 -Filter @{name='tag:Name'; values=$Servers} | Select -ExpandProperty instances | Select -expand InstanceId #Get instance ID } $instanceID
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)