Advertisement
naosuke84

vm-migrate.ps1

Sep 1st, 2017
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #script to migrate VMs off of VMWare host
  2.  
  3. #connects to VCenter
  4. connect-viserver VISERVERNAME
  5.  
  6. #sets source server
  7. $source = Read-Host 'What server are we moving VMs from?'
  8.  
  9. #Set's target server
  10. $target = Read-Host 'What Server are we moving VMs to?'
  11.  
  12. #Writes VMs to CSV for later migration back to host
  13. get-vmhost $source | get-vm | select Name | Export-Csv H:\Migrated-VMs.CSV -NoTypeInformation
  14.  
  15. #Moves VMs
  16. get-vmhost $source | get-vm | move-vm -destination $target -vmotionpriority high
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement