Created
February 27, 2015 19:28
-
-
Save pcgeek86/a92e9a80e06a425e580f to your computer and use it in GitHub Desktop.
Stop Microsoft Azure Virtual Machines in parallel
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
$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