
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
Advertisements