This week I am sharing a very helpful PowerCLI script to vMotion a vm from one SSO domain to another SSO domain. I shamelessly borrowed this script from Romain Decker’s site Cloud Maniac. The original script was very good and functioned well. I just took it a step further and added some functions to customize it for our environment. These functions are: Get-SourcevCenter, Get-DestvCenter, Ask-VMNameForMigration, Ask-DCForMigration, Ask-ClusterForMigration, Choose-StorageForVMMigration. The names of each function should explain their use. Essentially you will need to edit the script to customize some of these functions for your environment.
I have used it dozens of times and it works flawlessly with one exception. If your EVC modes don’t quite match between vCenters there may be some vms that cannot be vMotioned while powered on. Just arrange for a downtime and try again with the vm powered off. It will work well. This sure beats downloading a vm to your desktop and then uploading it to the new vCenter environment. If you need any explanation or help with modifying this code to fit your environment please feel free to comment.
( If you like this please check out some of my other PowerCLI posts like PowerCLI Get-vCenter Function )
Caution: Like all code you download from the internet, please understand and modify the code accordingly to prevent unforeseen production problems. Also known as career-altering events.
Cross SSO vMotion PowerCLI Code: