title: Start/Stop Instances in AWS and Wait with powershell
body: <p>I understand that it is quite easy to start and stop instances through Powershell:</p>
  
  <pre><code>$awsCreds = Get-AWSAutomationCreds
  Set-AWSCredentials -AccessKey $awsCreds.AccessKey -SecretKey $awsCreds.SecretKey
  Set-DefaultAWSRegion -Region us-east-1
  
  $instances = Get-EC2Instance -Filter @{name="tag:Name"; values="SERVERNAMES"} | Select -ExpandProperty Instances
  $instances.InstanceId | foreach {Stop-EC2Instance $_ -ErrorAction SilentlyContinue}
  </code></pre>
  
  <p>Is there a quick and dirty way that I am just not seeing through the AWS Powershell Cmdlets or even the .NET SDK that would allow me to either wait until the action is complete. And/Or update the collection of instance objects I gathered?</p>
  
  <p>Or am I stuck with running the: </p>
  
  <pre><code>$instances = Get-EC2Instance -Filter @{name="tag:Name"; values="SERVERNAMES"} | Select -ExpandProperty Instances
  </code></pre>
  
  <p>Command over and over until the state completely changes?</p>