title: Stop multiple Azure VMs at the same time using Azure PowerShell
body: <pre><code>Get-AzureRmVM -ResourceGroupName RG-VNETS | 
      ForEach-Object { 
          Get-AzureRmVM -ResourceGroupName RG-VNETS -Name $_.Name -Status 
      } | 
      ForEach-Object { 
          if (-Not ($_.Statuses[1].DisplayStatus -like "*deallocated*")) { 
              Stop-AzureRmVM -ResourceGroupName RG-VNETS -Name $_.Name -Force 
          } 
      }
  </code></pre>
  
  <p>I've got this script that stops all my Azure VMs, the catch here is that this script shuts down one VM at a time. </p>
  
  <p>i.e. if I have three VMs: VM1, VM2, VM3</p>
  
  <p>The script doesn't shut down VM2 until VM1 is fully shutdown and so on. I don't know if there's a way to tell PowerShell not to wait for each VM to be fully shutdown to proceed with the following one.</p>