- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get the Power state of the Azure VM using PowerShell?
There are the below Power State for the Azure VM.
Starting − The virtual machine is being started.
Running − The virtual machine is currently running
Stopping − The virtual machine is being stopped
Stopped − The virtual machine is currently stopped and but still incur compute charges.
Deallocating − The virtual machine is being deallocated.
Deallocated − The virtual machine is deallocated and released all the resources and does not incur the charges.
- − The Power State of the virtual machine is unknown.
To get the status of the virtual machine, there are two ways.
PS C:\> Get-AzVM -VMName Win2k16VM1 -Status
Output
You can see the PowerState of the VM is deallocated.
The other way to retrieve the status is by adding the -ResourceGroup property along with the -Status.
PS C:\> Get-AzVM -VMName Win2k16VM1 -ResourceGroupName TestVMRG -Status
Output
To get the status from the above output, you can modify the command as shown below.
PS C:\> $vm = Get-AzVM -VMName Win2k16VM1 -ResourceGroupName TestVMRG - Status PS C:\> $vm.Statuses[1].Code
Output
PowerState/deallocated
To get the output for the Multiple virtual machines in the Particular subscription,
PS C:\> Get-AzVM -Status
- Related Articles
- How to check Azure VM Power state using PowerShell?
- How to get the Azure VM Size using Azure CLI in PowerShell?
- How to get the Azure VM username using Azure CLI in PowerShell?
- How to get the location of the Azure VM using Azure CLI in PowerShell?
- How to get the Azure VM DNS name using PowerShell?
- How to get the Azure VM available sizes using PowerShell?
- How to get the installed Azure VM extension using PowerShell?
- How to get the available azure VM size using Azure CLI in PowerShell?
- How to get Azure VM activity logs using PowerShell?
- How to get the Accelerated networking status of Azure VM using PowerShell?
- How to get the Azure VM disk encryption settings using PowerShell?
- How to get the Azure VM disk caching settings using PowerShell?
- How to get the Azure VM storage account type using PowerShell?
- How to get the Application security groups of the Azure VM using PowerShell?
- How to get all the available azure VM images using Azure CLI in PowerShell?
