Re-size VHD

Re-sizes a virtual hard disk. This cmdlet lets you shrink or expand the size of a virtual hard disk, but the shrink operation is allowed only on VHDX virtual hard disks. The shrink operation fails if it would shrink the virtual disk to less than its minimum size (available through the VHDX object's minimum size property). Resize-VHD is an offline operation. The virtual hard disk must not be attached when the operation is initiated.

Input Parameters

Name Type Required Description
VHD File Path String Yes Specifies the path to the virtual hard disk that is to be resized.
Shrink to Minimum Size Boolean No Specifies that the virtual hard disk is to be resized to its minimum possible size.
New Size String No Specifies the size to which the virtual hard disk is to be resized.

Output Parameters

Name Type Description
Result Number Returns a success value of zero or any value other than zero to indicate failure.

Example Input Parameters

Name Type Required Example
VHD File Path String Yes c:\test\testvhdx.vhdx
Shrink to Minimum Size Boolean No Optionally, you can shrink the VHD to the minimum possible size.
New Size String No 1TB