Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible values for state & status of Virtual machines

We can get the list of VMs with powershell cmdlets "Get-VM". The returned set have two columns "State" and "Status". I need to know what are the possible state or status may be for a VM. I have an application that need to perform various action based on the state of VM (specially error state).

like image 922
Vicky_Burnwal Avatar asked Sep 10 '25 15:09

Vicky_Burnwal


1 Answers

you can use powershell command:

Import-Module Hyper-V

[enum]::GetNames([Microsoft.HyperV.Powershell.VMState])
[enum]::GetNames([Microsoft.HyperV.Powershell.VMOperationalStatus])

enter image description here

like image 173
Mihail Kuznesov Avatar answered Sep 13 '25 08:09

Mihail Kuznesov