Previous Topic: dpmhv-getVMState (Funclet) Command--Show the VM StateNext Topic: dpmhv-importVMEx (Funclet) Command--Copy and Import VM


dpmhv-importVM (Funclet) Command--Import a VM

The dpmhv-importVM command imports an exported VM, which was exported using dpmhv-exportVM command. You can import VM for only one time as it is imported to a location similar to the exported VM.

This command has the following format:

dpmhv-importVM 
-host hostname 
-path pathname 
[-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.

-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-importVM 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 a VM

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

dpmhv-exportVM -host hvserver -vm TestVM -dest c:\Ex\MyVM dpmhv-importVM 
-host hvserver -path c:\Ex\MyVM -vm TestVM1

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