When you run a server operating system in your laptop, there’s a ton of stuff that you need to consider. Today, I spent almost the entire day trying to make sure that all of the drivers work on my DELL Latitude E6520. And since I run the Hyper-V role on my Windows Server 2012 machine, the first thing I did was to import all of my virtual machines from the old laptop to the new laptop. I currently have at least 14 virtual machines in my laptop. Since I do a lot of high availability and disaster recovery presentations, having that many virtual machines is just the norm for me. I took my external hard drive and started exporting all of my virtual machines.
Get-VM | Export-VM -Path "F:VirtualMachines"
That command exports all of the Hyper-V virtual machines from my old laptop and copy them to the external hard drive. After plugging in the external hard drive to the new laptop, I copied the entire folder to the D: drive. Once the copy process was completed, I imported all of the virtual machines into Hyper-V.
PS D:VirtualMachines> Get-ChildItem -recurse *.xml | Import-VM
Pretty slick especially when you’re dealing with several Hyper-V 3.0 virtual machines that you need to copy from one machine to another. And, as always, the simplicity of a one-liner command is what I use to convince IT administrators to start playing around with Windows PowerShell. Exporting and importing my Hyper-V virtual machines only took less than 20 minutes.
Please note: I reserve the right to delete comments that are offensive or off-topic.