Previous Topic: dpmhv-destroyVM (Cmdlet) Command--Delete VMNext Topic: dpmhv-exportVM (Funclet) Command--Export a VM


dpmhv-expandVirtDisk (Funclet) Command--Expand Virtual Disk

The dpmhv-expandVirtDisk command lets you increase the virtual disk size. To use the expanded virtual disk space, you must partition the virtual disk in the guest operating system running on a virtual machine.

This command has the following format:

dpmhv-expandVirtDisk 
-host hostname 
-path pathname 
-sizeGB size 
[-async]
[-retval] 
[-silent]
-host hostname

Specifies the name of the Hyper-V server host.

-path pathname

Specifies the path name of the virtual disk that you want to expand.

-sizeGB size

Specifies the size of the virtual disk in gigabytes.

-async

(Optional) Specifies the option to execute the command asynchronously. By default, this command is executed synchronously.

Note: If this command completes the execution before executing this option, it returns a job ID that is used to view the operation status.

-retval

Returns a value for further processing.

-silent

Specifies not to direct the output to the screen.

Return Value

The dpmhv-expandVirtDisk command returns an empty string when it is executed synchronously. If executed asynchronously, a string representing job ID is passed to dpmhv-getJobErrorInfo, dpmhv-getJobInfo, or dpmhv-getJobStatus. In synchronous mode, if an error occurs during execution, the command returns the error code and reports the error.

Example: Expand Virtual Disk

This example expands the size of the virtual disk to 4 GB.

dpmhv-expandVirtDisk -host hvserver -path C:\VMDisks\hdd.vhd -sizeGB 4