Skip to content

Instantly share code, notes, and snippets.

@sqlchow
Created November 17, 2015 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sqlchow/8c960912ca1c703c2b42 to your computer and use it in GitHub Desktop.
Save sqlchow/8c960912ca1c703c2b42 to your computer and use it in GitHub Desktop.
Quickly get Azure ARM VM PowerState
#To use with the newer Azure PowerShell use Get-AzureRmVM instead of Get-AzureVM
Get-AzureVM -Name 'AzureRmVM01' -ResourceGroupName 'arm-rg' -Status | `
Select-Object -ExpandProperty Statuses | Where-Object {$_.Code -like '*PowerState*'} | `
Select-Object @{l='PowerState';e={$_.Code.Split('/')[1]}}
@josephsctan
Copy link

Get-AzureRmVM, is what I think you mean. What are the valid PowerStates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment