I have VMs that I need to live migrate from one cluster to another. Each hosts in both clusters have access to a large datastore we use as a swing volume. I have created a script that will first migrate the VM to the swing volume, then to a host in the new cluster, and then to its permanent datastore.
I plan to hand this task off to some other admins to perfom the migrations. These other admins have no powercli experience, and I have very little.
As you can see looking at my script that there is no intellegence built in. I have to rely on the admins to verify the portgroup that the VM is currently connected is avilable on the new hosts, and that the datastore has enough space without completely filling the LUN. I like to leave 40GB free on the LUN after the migration.
Does anyone know how I could build in some intellegence that would verify the portgroup exist, and the LUN has enough space?
VM_Cluster_Migration.ps1
------- Script Start --------
$tempLun = "SWING_VOLUME_NAME"
$vmName = (Read-Host " Enter VM Name to Migrate")
$newHost = (Read-Host " Enter Host to migrate " $vmName " to")
$newLun = (Read-Host " Enter new Datastore")
Get-VM $vmName |Move-VM -datastore (Get-datastore $tempLun)
Get-VM $vmName | Move-VM -Destination (Get-VMHost $newHost) -RunAsync
Get-VM $vmName |Move-VM -datastore (Get-datastore $newLun)
-------Script End ---------
Any help would be greatly appreciated.
Thanks in advance,
-geob