A little history. I'm trying to migrate some VMs from a cluster running vSphere 5.1 to a new vSphere 6.0 vSAN Cluster. Via the web client, if I do a migrate both Compute & Storage option, and choose STORAGE FIRST, I can go through the wizard, choose the destination vSAN Datastore, then the host in that cluster, then the destination Network Portgroup, and I get a warning...
"Network interface" 'Network adapter 1' cannot use network 'VMNetwork_VLAN2 (vDSwitch)', because "the destination distributed switch has a different version or vendor than the source distributed switch".
Even though I get that warning, it lets me proceed.
I'm trying to automate this migration and wrote the following PowerCLI Script, however PowerCLI is failing where the Web Client doesn't.
move-vm : 9/12/2017 3:07:37 PM Move-VM The operation for the entity
"VM1" failed with the following message: "A general system error
occurred: vmodl.fault.SystemError"
At E:\ps1\vmware\Migrate.ps1:146 char:2
+ move-vm -VM (get-vm $VM) -Datastore (get-datastore "vsanDatastore
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Move-VM], SystemError
+ FullyQualifiedErrorId : Client20_TaskServiceImpl_CheckServerSideTaskUpda
tes_OperationFailed,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM
The script:
$migrate = import-csv -path e:\ben\vmware\migrate.csv
foreach ($row in $migrate) {
# Read from CSV's Name Column
$VM = $row.Name
$Network = $row.Network
# Shutdown the VM
shutdown-vmguest $VM -confirm:$false
# Wait 15 seconds for the VM to shutdown.
start-sleep 15
# Perform the vMotion
move-vm -VM (get-vm $VM) -Datastore (get-datastore "LNvsanDatastore") -destination vmhost1.domain.com -confirm:$false
# Change the Network Adapter Portgroup
Get-VM $VM | set-networkadapter -Network Adapter "Network Adapter 1" -Networkname (Get-virtualportgroup -Name $Network) -StartConnected:$true -Confirm:$false
# Power on the VM
Start-vm (get-vm $VM) -confirm:$false
}
Please help!
Thanks in advance!