Skip to content

Instantly share code, notes, and snippets.

/script move vm Secret

Created January 11, 2016 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/660264b2139b150f7e53 to your computer and use it in GitHub Desktop.
Save anonymous/660264b2139b150f7e53 to your computer and use it in GitHub Desktop.
#Same Storage location
$StoragePath = "C:\yourstoragelocation\here\"
#VMs which will be migrated Get-VM will migrate all VMs
$VMs = Get-VM
Move-VM -Name $VMs -DestinationHost SECRETSERVERNAME
Foreach ($VM in $VMs) {
$VMStorage = $StoragePath + $VM.Name
Write-Host "Moving VM:" $VM "to" $VMStorage
Move-VM - Name $VMs -DestinationStoragePath $VMStorage
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment