export-vm - not exporting the vhd

Oct 14, 2010 at 7:16 PM

Hello All,

I am using a simple PS script to shutdown and export the VMs and it is not exporting the virtual disk, here is portion of the script:

export-VM -server "hostA" -vm "VMA01" -path E:\Exported -force -wait

 It works fine and fast but again, does not export the vdh, any help is appreciated.

Exported VM folder structure with this script:


E:\Exported\VMA01\Virtual Machines


The E:\Exported\VMA01\Virtual Hard Disks - missing


Nov 14, 2010 at 11:41 PM

By default Export-VM does not copy state.  Per the documentation you need to add -CopyState to have it copy "the state, such as virtual hard disks, saved state files, and memory content files"

Nov 15, 2011 at 4:25 PM

DBeadle - In case you weren't able to put what Tony had said to use.  The script I use to export the VM is as follows:

Local Machine - export-vm -vm VMName E:/ImportFolder - copystate -force

Remote Machine - Export-vm -server ServerName -vm VMName E:/ImportFolder (Import folder is the path of the HyperV Host).  While issuing this command it will save to whatever machine you specify after -server

Any more questions, feel free to let me know.

Nov 15, 2011 at 4:27 PM

Thanks, I shall re-visit this project and try :)