PowerTip: Identify All Stopped Azure Virtual Machines with PowerShell

Doctor Scripto

Summary: Identify virtual machines that are shut down, but are consuming billing time.

Hey, Scripting Guy! Question How can I use Windows PowerShell to track virtual machines that are not shut down from
           the management portal in Azure?

Hey, Scripting Guy! Answer Use the Get-AzureVM cmdlet, and filter on 'StoppedVM' status:

Get-AzureVM | Where { $_.Status –eq 'StoppedVM' }

You can then properly shut down all of them with the Stop-AzureVM cmdlet:

Get-AzureVM | Where { $_.Status –eq 'StoppedVM' } | Stop-AzureVM

0 comments

Discussion is closed.

Feedback usabilla icon