Skip navigation
migrating birds

Use Hyper-V Live Storage Migration to Move Virtual Machines

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-VM

foreach ($VM in $VMstoMove)
{
    write-host $VM.Name
    $newpath = "C:\ClusterStorage\VM01\" + $VM.Name
    Move-VMStorage -DestinationStoragePath $newpath -VM $VM
}

You need to change the value of $newpath to match your new path.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish