IVMHardDisk::Compact method

[Windows Virtual PC is no longer available for use as of Windows 8. Instead, use the Hyper-V WMI provider (V2).]

Compacts a dynamically expanding virtual hard disk image.

Syntax

HRESULT Compact(
  [out, retval] IVMTask **compactTask
);

Parameters

compactTask [out, retval]

An IVMTask object that is used to track the completion the compaction process.

Return value

This method can return one of these values.

Return code/value Description
S_OK
0
The operation was successful.
DISP_E_EXCEPTION
0x80020009
An unexpected error has occurred.
E_POINTER
0x80004003
The parameter is NULL.
HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION)
0x80070020
The virtual hard disk image referenced by this IVMHardDisk object is in use.
HRESULT_FROM_WIN32(ERROR_DISK_FULL)
0x80070070
The host volume does not have enough space to create a temporary file needed for the compaction of this virtual hard disk image.
VM_E_APP_SHUTTING_DOWN
0xA0040209
The virtual hard disk image cannot be compacted because the application is shutting down.
VM_E_FILE_READ_ONLY
0xA004067A
The virtual hard disk image referenced by this IVMHardDisk object is marked as read only.
VM_E_WRONG_HD_IMAGE_TYPE
0xA004067B
The virtual hard disk image referenced by this IVMHardDisk object must be a vmDiskTypeDynamic image type.
VM_E_INVALID_HD_FILE
0xA0040682
The virtual hard disk image referenced by this IVMHardDisk object does not seem to be a valid image.

Remarks

To compact a dynamically expanding hard disk image, free space on the disk image should first be zeroed.

Requirements

Requirement Value
Minimum supported client
Windows 7 [desktop apps only]
Minimum supported server
None supported
End of client support
Windows 7
Product
Windows Virtual PC
Header
VPCCOMInterfaces.h
IID
IID_IVMHardDisk is defined as ffa14ae6-48f5-42a4-8a22-186f2e5c7db0

See also

IVMHardDisk