# How to check Azure VM Power state using PowerShell?

PowerShellMicrosoft TechnologiesSoftware & Coding

To check if the VMs are running, deallocated, or stopped using PowerShell, we need to use the - Status parameter.

If you write only the Get-AzVM command to get the VM details, it won’t show up the Azure VM power status default.

## Example

To check the Azure VM Power Status,

Get-AzVM -status

## Output

The above command will show the Power State for all VMs for that particular subscription. For different subscriptions, you need to change the subscription and run this command.

To get the VM Power State for the specific ResourceGroup, use the ResourceGroup name parameter.

## Example

For example,

Get-AzVM -ResourceGroupName TestVMRG -Status

The above command will retrieve all VM Power states from the resource group TestVMRG.

## Example

For the specific VM Power state, you need to provide a particular VM name, as shown below.

Get-AzVM -VMName Win2k16vm1 -Status

## Output

Updated on 01-Mar-2021 10:51:55

Advertisements