> ## Content Index
> Fetch the complete content index at: https://codeisahighway.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to get the status of a Virtual Machine under the v2 compute model in Azure PowerShell v1.0.x
- URL: https://codeisahighway.com/how-to-get-the-status-of-a-virtual-machine-under-the-v2-compute-model-in-azure-powershell-v1-0/
- Published: 2015-12-23T12:03:00.000Z
- Updated: 2026-08-10T07:12:39.000Z
- Author: Stephane Lapointe
- Tags: PowerShell, Microsoft Azure, DevOps, Automation, #Import 2023-07-11 16:44, #Import 2026-09-04 10:31, #Import 2026-09-04 13:56

Getting the status of a virtual machine is really handy because once you have that information you can then take decisions and perform several actions on your virtual machines like starting it, stopping it, etc.

## List all virtual machines in a subscription

To list all the virtual machines in a specific subscription you can execute the following:

```powershell
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionName $mySubscriptionName
Get-AzureRmVM

```

## List all virtual machines in a specific resource group

To list all the virtual machines of a specific resource group you can execute the following:

```powershell
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionName $mySubscriptionName
Get-AzureRmVM -ResourceGroupName $myResourceGroupName

```

# Get the status of a specific virtual machine

All the examples above, regardless of the scope to list will give you the base definition of a virtual machine. To get the status of it, you need to provide the `-Status` switch. It will take a bit more time, but this time you'll have a completely different response than the previous calls we made. It will contain the information you are looking for in the `Statuses` member.

```
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionName $mySubscriptionName
$vm = Get-AzureRmVM -ResourceGroupName $myResourceGroupName -Name 'MyVMName' -Status
$vm.Statuses

```

You will have all the VM information you need to automate your scale up/down and automation scenarios... Enjoy!

### References

- [Resource Group introduction](https://azure.microsoft.com/en-us/documentation/articles/resource-group-overview/?ref=codeisahighway.com#resource-groups)
- [Azure PowerShell 1.0 Cmdlets Reference](https://msdn.microsoft.com/en-us/library/azure/mt619274.aspx?ref=codeisahighway.com)
- [Azure PowerShell v1.0.4 - December 2015](https://github.com/Azure/azure-powershell/releases/tag/AzureRMv1.0.4-December2015?ref=codeisahighway.com)