This Automation Manager object otimizes the allocation of space in or more virtual hard disk files, except for fixed virtual hard disks. The Optimization Mode operation is used to optimize the files. This operation reclaims unused blocks as well as rearranges the blocks to be more efficiently packed, which reduces the size of a virtual hard disk file. To use Optimize VHD, the virtual hard disk must not be attached or must be attached in read-only mode. The compact operation can succeed without reducing the file size, if no optimization is possible.
|VHD File Path||String||Yes||Specifies one or more paths to the dynamic or differencing virtual hard disk files to be optimized.|
Specifies the mode in which the virtual hard disk is to be optimized. For a VHD disk, the default mode is Full. For a VHDX disk, the default mode is Quick. Valid modes are as follows:
|Read Only||Boolean||No||Specifies that the virtual hard disk is to be mounted in read-only mode.|
|Result||Number||Returns a success value of zero or any value other than zero to indicate failure.|
Example Input Parameters
|VHD File Path||String||Yes||c:\test\testvhdx|
Specify the mode in which the VHD is to be optimized from: