Previous Topic: dpmhv-importVM (Funclet) Command--Import a VMNext Topic: dpmhv-setSysprepProperties (Cmdlet) Command--Create a Virtual Disk


dpmhv-importVMEx (Funclet) Command--Copy and Import VM

The dpmhv-importVMEx command lets you import and copy an exported VM, which was exported using dpmhv-exportVMEx command. You can import VM for multiple times as it is imported to a location different to the exported VM.

This command has the following format:

dpmhv-importVMEx 
-host hostname 
-path pathname 
[-dest dest] 
[-vm vmname]
[-nonewid]
[-async]
[-retval] 
[-silent]
-host hostname

Specifies the name of the Hyper-V server host.

-path pathname

Specifies the path of the VM that you want to import and copy.

-dest dest

Specifies the destination path to import and copy the VM to.

-vm vmname

Specifies the name of the VM.

-nonewid

(Optional) Specifies not to generate a unique GUID for the VM that you want to import. The imported VM has the GUID similar to the source VM (exported VM). Two VMs with same GUID creates conflicts and is not recommended.

-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-importVMEx 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: Import VM

This example imports a VM which is exported using dpmhv-exportVMEx command.

dpmhv-exportVMEx -host hvserver -vm TestVM -dest c:\Ex\MyVM -nosubdir
dpmhv-importVMEx -host hvserver -path c:\Ex\MyVM -dest C:\VMs\TestVM1 -vm TestVM1

Additionally, you can issue dpmhv-importVMEx command to create multiple VMs from the originally exported VM.