Skip to content

Instantly share code, notes, and snippets.

@PartTimeLegend
Created April 7, 2021 14:49
Show Gist options
  • Select an option

  • Save PartTimeLegend/0a028614d290423835630240a7a9f676 to your computer and use it in GitHub Desktop.

Select an option

Save PartTimeLegend/0a028614d290423835630240a7a9f676 to your computer and use it in GitHub Desktop.
Determine a Azure VM running status
function Get-AzVMStatus
{
param(
[Parameter(Mandatory=$true)][string]$resourceGroup,
[Parameter(Mandatory=$true)][string]$vmName,
)
return (Get-AzVM -ResourceGroupName $resourceGroup -Name $vmName -Status).Statuses[1].DisplayStatus
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment