Aidan Finn (Virtual Machine MVP) just made a blog post about Hyper-V & PowerShell in Windows Server 8 and how you can enable Hyper-V via PowerShell in Windows Server 8. So this gave me the idea about doing a little more with PowerShell and Hyper-V 3.
I already did a blog post about how you can attach multiple VHDs to a SCSI Controller with PowerShell in Windows Server 8. In this post I will show how easy you can export and import a lot of Virtual Machines.
First you can run a Get-VM Test*, to check which VMs you will export.
Now you can export the Virtual Machines
Get-VM Test* | Export-VM -Path "C:\VMs"
Now I removed the Virtual Machines in Hyper-V with Powershell (You could also add the -confirm parameter so you don’t have to press “y” for each VM.
Get-VM Test* | Remove-VM
And now you can import the Virtual Machines again
Get-Childitem "C:\VMs" -Recurse *.xml | Import-VM
I will post more about PowerShell in Windows 8 and Windows Server 8 (Hyper-V 3) in the next upcommig weeks. If you want know more about what new Hyper-V features and improvments are coming in Windows Server 8, you can read the following blog post: “Hyper-V: Version 3 kills them all”
Tags: Export-VM, Hyper-V, Hyper-V 3, Import-VM, Microsoft, PowerShell, Powershell 3, Virtual machines, Virtualization, VM, Windows, Windows 8, Windows Server 8, xport VMs with PowerShell Last modified: January 7, 2019
Can you post a script for exporting and importing the configuration of a VM only?
So something as the below website, but for Win8/2012 instead of Win2K8R2?
The script in the above link does unfortunately not work for Win8
I am looking for the sricpt which take the backups for live all Hyper-v Host in zip format. Please guide me.