Use Hyper-V Live Storage Migration to Move Virtual Machines
Use a few lines of Windows PowerShell code to move virtual machines to a new storage location.
John Savill
April 9, 2014
1 Min Read
Q: How can I easily move all the virtual machines in my cluster to new storage?
A: The Hyper-V Live Storage Migration feature allows you to easily move a virtual machine's (VM's) storage to a new location without affecting the VM's availability. You can use a few lines of PowerShell code to move every VM in a cluster to a new storage location:
#Get list of all virtual machines running as cluster resources$VMstoMove = Get-ClusterResource | Where-Object {$_.ResourceType -eq "Virtual Machine"} | Get-VMforeach ($VM in $VMstoMove){ write-host $VM.Name $newpath = "C:ClusterStorageVM01" + $VM.Name Move-VMStorage -DestinationStoragePath $newpath -VM $VM}
You need to change the value of $newpath to match your new 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