Example of Import-VM available?

Apr 28, 2010 at 4:17 AM

I try to use the Import-VM but I keep on getting errors or some output without that my virtual machines show up in the UI of Hyper-V R2.

What I want to do is rather simple: Instead of using the UI for IMPORTING virtual machines (which have been exported earlier), I'd like to use Import-VM with an option to create a COPY and DUPLICATE, as the UI allows me to select.

Anyway I am a bit irritated that I need to point to one or multiple VHD files, instead of the config.xml file, as the UI requires.
So I created an array of my .VHD files via $a = "path\vhd1", "path\vhd2"

Is it possible to use Import-VM instead of the UI for importing VMs as copies and duplicates or do I need to look for something else?

Thank you in advance.

Mar 31, 2011 at 4:07 PM

HELP!!!!  I to am having an issue with Import-VM and cannot find any examples.  I am trying to import a VM located on an external USB Drive, and when I use the code to grab the .vhd files for import-vm, import-vm assumes that is where the configuration information is, but it is  in the directory above.  How do I change the directory once I have given Import-VM the path to the .vhd files?  If I try to enter another -paths statement, it chokes.

Jun 22, 2011 at 7:11 PM



Not a single example of Import-VM on the net? Anyone help here?

Aug 3, 2011 at 6:14 PM

I just found these modules, but I beleive based on what I read in the minimal documentation of import-vm that this function should be upgraded to work with R2. They mention zip files and the like, and i don't think those are created under Hyper-V R2. I just did a quick search in the template tree i created and there are no zip files to be found.

The link from get-help import-vm -online (http://msdn.microsoft.com/en-us/library/cc136798(VS.85).aspx) states that this method is deprecated in favor of a new method (http://msdn.microsoft.com/en-us/library/dd379583(v=VS.85).aspx)

I haven't checked but if nobody has posted a ticket regarding this, i'll toss one in there.