PowerTip: Identify All Stopped Azure Virtual Machines with PowerShell


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

Comments (0)

Skip to main content