Skip to content

Instantly share code, notes, and snippets.

@pcgeek86
Created February 27, 2015 19:28
Show Gist options
  • Save pcgeek86/a92e9a80e06a425e580f to your computer and use it in GitHub Desktop.
Save pcgeek86/a92e9a80e06a425e580f to your computer and use it in GitHub Desktop.
Stop Microsoft Azure Virtual Machines in parallel
$VMList = Get-AzureVM;
foreach ($VM in $VMList) {
Start-Job -ScriptBlock {
Write-Output -Message ('Stopping VM {0} {1}' -f $args[0].ServiceName, $args[0].Name);
Stop-AzureVM -ServiceName $args[0].ServiceName -Name $args[0].Name -Force;
} -ArgumentList $VM;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment