Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
How to check Azure VM Power state using PowerShell?
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.
Output

Example
For the specific VM Power state, you need to provide a particular VM name, as shown below.
Get-AzVM -VMName Win2k16vm1 -Status
Output

