Cry about...
Windows Hyper-V-Server
How to export a virtual machine using PowerShell
You can export a virtual machine using the PowerShell cmdlet export-vm:
Export-VM -Name 'VM-Name' -PATH 'C:\Export-Path'
substituting the name of the virtual machine for VM-Name in the above and the export path for the path you want to use. This cmdlet won't return until the export is complete.
Depending on the version of hyper-v-server that you are running on you might have to shut the virtual machine down first.
Be aware that if you are exporting to a network share then the COMPUTER running Hyper-V will need to be granted access to the network share.
if you want to run this from a .cmd/.bat file then it becomes:
powershell -NonInteractive -Command "Export-VM -Name 'VM-Name' -PATH 'C:\Export-Path'"
About the author: Brian Cryer is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.