Previous Topic: dpmhv-exportVM (Funclet) Command--Export a VMNext Topic: dpmhv-getHostSwitches (Funclet) Command--Show Host Switches on a Hyper-V Host


dpmhv-exportVMEx (Funclet) Command--Export a VM

The dpmhv-exportVMEx command lets you export VM specifications, including its related virtual disks, floppy disks and snapshots.

This command has the following format:

dpmhv-exportVMEx 
-host hostname 
-vm vmname|-vmid vmguid 
-dest dest 
[-noruntimeInfo]
[-nosnapshots]
[-nostorage]
[-nosubdir] 
[-snapshot ss]
[-snapshotid ssguid]
[-async]
[-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.

-dest dest

Specifies the destination path of the VM that you want to export.

-noruntimeInfo

(Optional) Specifies not to export runtime information of the VM.

-nosnapshots

(Optional) Specifies not to export snapshots of the VM. This option exports only the current state of the VM.

-nostorage

(Optional) Specifies not to export the virtual disk of the VM.

Note: Do not use this option when you export the snapshot of the VM.

-nosubdir

(Optional) Specifies not to create a sub directory with the VM display name underneath the directory specified as the export path.

-snapshot ss

(Optional) Specifies the display name of the snapshot of the VM. The exported VM is in the state (snapshot) similar to the source VM. The exported VM does not include snapshot.

Note: Use
-ssid option as snapshot display name is not unique in the Hyper-V environment.

-snapshotid ssguid

(Optional) Specifies the unique ID (GUID) of the snapshot of the VM. The exported VM is in the state (snapshot) similar to the source VM. The exported VM does not include snapshot.

-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-exportVMEx 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: Export a VM Without Snapshots

This example exports a VM without snapshots.

dpmhv-exportVMEx -host hvserver -vm TestVM -dest c:\Ex\TestVM1 -nosubdir -nosnapshots