Previous Topic: dpmhv-setVMDisk (Funclet) Command--Create a Drive or Disk on a Drive ControllerNext Topic: dpmhv-SetVMVirtFloppy (Cmdlet) Command--Connect a Virtual Floppy Image to the VM Floppy Drive


dpmhv-setVMProperties (Cmdlet) Command--Set VM Properties

The dpmhv-setVMProperties command lets you set the properties of the VM.

This command has the following format:

dpmhv-setVMProperties 
-host hostname 
-vm vmname|-vmid vmguid 
[-name name] 
[-mem mem] 
[-cpus cpus] 
[-cpuidlimit limit]
[-cpureserve reserve] 
[-cpulimit limit] 
[-cpuweight weight]
[-startAction {none,auto,always}] 
[-startDelay delay]
[-stopAction {save,off,shutdown}] 
[-recoveryAction {none,restart,revert}]
[-retval] 
[-silent]
-host hostname

Specifies the name of the Hyper-V server host.

-vm vmname

Specifies the name of the VM.

-vmid vmguid

Specifies the unique ID of the VM.

-name name

Displays the name of the VM.

-mem mem

(Optional) Specifies the RAM memory in megabytes (MB) for the VM that you want to create.

Default: -1

-cpus cpus

(Optional) Specifies the number of CPU cores to assign to the VM.

-cpuidlimit limit

(Optional) Specifies the limit of CPU ID functionality of VM. This option improves the compatibility with legacy operating systems such as Windows NT.

Default: -1

-cpureserve reserve

(Optional) Specifies the percentage of the CPU that you want to reserve for the VM. If this option is not specified, Hyper-V server assigns CPU cycles based on the overall system usage.

Default: -1

-cpulimit limit

(Optional) Specifies the limit for the number of CPU resources used by a VM. This option improves the compatibility while moving VMs between physical hosts with different CPU capabilities.

Default: -1

-cpuweight weight

(Optional) Specifies the relative weight of the virtual machine. This option controls resource allocation when more than one VM is running. Valid entry: integer, 1-10000.

Default: -1

-startAction {none,auto,always}

(Optional) Specifies the action that you want to perform on the VM when the Hyper-V host starts up. Options include the following:

none

Performs no action.

auto

Starts the VM automatically.

Note: Use this option if the VM was running before the Hyper-V host is shut down.

always

Starts the VM always.

-startDelay delay

(Optional) Specifies the delay in seconds to start the VM after the Hyper-V host is up and running.

Default: -1

-stopAction {save,off,shutdown}

(Optional) Specifies the action that you want to perform on the VM when the physical Hyper-V shuts down. Options include the following:

save

Suspends the VM.

off

Power offs the VM.

shutdown

Shuts down the system.

-startDelay delay

(Optional) Specifies the delay in seconds to start the VM after the Hyper-V host is up and running.

Default: -1

-recoveryAction {none,restart,revert}

(Optional) Specifies the action to perform on the VM after the Hyper-V host restarts from unexpected shutdown. Options include the following:

none

Performs no action.

restart

Restart the VM.

revert

Reverts to the last snapshot of the VM.

-retval

Returns a value for further processing.

-silent

Specifies not to direct the output to the screen.

Example: Change number of Core CPUs

This example changes the number of CPU cores assigned to the VM to two. To run the command successfully, turn off the VM.

dpmhv-setVMProperties -host hvserver -vm TestVM -cpus 2