Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
To Shutdown all Azure VM you don't need to go to individual and then press the button. But run an elegant PowerShell
$AzureSubscriptions = Get-AzureSubscription
foreach ($subscription in $AzureSubscriptions)
{
Write-Host $subscription.SubscriptionName
Select-AzureSubscription -SubscriptionName $subscription.SubscriptionName
#Write-Host $subscription.SubscriptionName
foreach ($vm in Get-AzureVM)
{
$name = $vm.Name
$servicename = $vm.ServiceName
If($vm.Status -ne 'StoppedDeallocated')
{
# Add the VM's which should not be shutdown
Write-Host 'Stopping ' + $name
Stop-AzureVM -Service $servicename -name $name
}
# do lots of other stuff
}
}
Namoskar!!!
Comments
Anonymous
June 21, 2015
How to avoid pressing "yes" for each machine??Anonymous
July 06, 2015
use -ForceAnonymous
July 06, 2015
To avoid pressing Yes, use Stop-AzureVM -Service $servicename -name $name -Force