Export Virtual Machines in a Cluster

Use PowerShell to export all virtual machines in a cluster.

John Savill

October 2, 2014

1 Min Read
virtual machines

Q: How can I easily export every virtual machine in a cluster to a folder?

A: The best approach for protecting your virtual environment is using a VSS-aware protection such as System Center Data Protection Manager. However,  you might occasionally just want to quickly export every virtual machine out to a folder. This is easy to do with just a few lines of PowerShell code.

$VMs = Get-ClusterGroup | ? { $_.GroupType –eq "VirtualMachine" } | Get-VMForeach ($VM in $VMs){    Export-VM -ComputerName $VM.computername -Name $VM.name -Path C:ClusterStorageStorageSpace_VMsBackup}

The end result is that each virtual machine will be in its own subfolder under the specified path.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like