Previous Topic: dpmhv-getVMProperties (Funclet) Command--Show VM PropertiesNext Topic: dpmhv-importVM (Funclet) Command--Import a VM


dpmhv-getVMState (Funclet) Command--Show the VM State

The dpmhv-getVMState command retrieves the power state of the VM.

This command has the following format:

dpmhv-getVMState 
-vm vmname|-vmid vmguid 
-host hostname 
[-retval]
[-silent]
-vm vmname

Specifies the name of the VM.

-vmid vmguid

Specifies the unique ID of the VM.

-host hostname

Specifies the name of the Hyper-V server host.

-silent

Specifies not to direct the output to the screen.

-retval

Returns a value for further processing.

Return Value

The dpmhv-getVMState command returns a string indicating the power state of the VM. The values returned are:

Example: Show the VM State

This example checks whether the VM is running.

s = dpmhv-getVMState -host hvserver -vm TestVM -retval -silent 
if(s=="enabled")
? "VM is running"
else
? "VM is not running"