Skip navigation
Quick live storage move all VMs to another location

Quick live storage move all VMs to another location

Q. How can I quickly move the storage of every VM on a server to another location?

A. The PowerShell below will move the storage of every VM on a server to a new location. You should change the $newpath variable with the static path that you want for your new VM storage location.

$VMstoMove = Get-VM | Select-Object -expandProperty Name

foreach ($VM in $VMstoMove)
{
    write-host $VM
    $vmobj = get-vm -Name $VM
    $newpath = "F:\VMs\" + $VM
    Move-VMStorage -DestinationStoragePath $newpath -VM $vmobj
}

 

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