We're getting ready to migrate from ESX to AHV, an...
# citrix-vad
n
We're getting ready to migrate from ESX to AHV, and one of the steps is to migrate existing VDAs from their existing catalogs to new ones that use AHV hypervisor connections. Doing it manually in Citrix Cloud works fine, but obviously, that's not feasible for 6500 VDAs. I've been trying to do this via PS, and am getting stuck. In a nutshell, this is what the script is doing:
Copy code
$VDAs = Get-Content .\VDAs.txt
$SourceCatalogName = "OldCatalog"
$InputFile = Get-BrokerMachine -CatalogName $SourceCatalogName -MaxRecordCount 100000 | Where { $_.HostedMachineName -in $VDAs } | Export-Clixml ".\Migration.xml"
$VMs = Import-Clixml -Path $InputFile

$HostingConnectionDetail = Get-BrokerHypervisorConnection | Where { $_.Name -eq "NewHostingConnection" }
$Catalog = Get-BrokerCatalog -Name  "NewCatalog"

#Turn on Maintenance Mode
Set-BrokerMachine -MachineName $VM.MachineName -InMaintenanceMode $true
#Remove from the existing Delivery Group
Remove-BrokerMachine -MachineName $VM.MachineName -DesktopGroup $VM.DesktopGroupName
#Remove from the existing Machine Catalog
Remove-BrokerMachine -MachineName $VM.MachineName
#Add to the new Machine Catalog
New-BrokerMachine -CatalogUid $Catalog.Uid -HostedMachineId $VM.HostedMachineId -HypervisorConnectionUid $HostingConnectionDetail.Uid -MachineName $VM.SID
#Add to the Delivery Group (same as previous one)
Add-BrokerMachine -MachineName $VM.MachineName -DesktopGroup $DeliveryGroupName
The script completes successfully, and I see the VDA in Citrix Cloud in the correct MC and DG, and the VDA registers. However, the Power State shows as Unknown. If I query the VDA using Get-BrokerMachine, one thing I immediately notice is that certain fields are blank, like HostedMachineName and HostingServerName. I have to be missing something obvious, and I've stared at this long enough where I need another set of eyes. Any chance somebody sees where I'm going wrong here?
Okay, so it was pointed out to me that using the old HostedMachineId was probably the issue, and it appears as though that was the case. I had to install the Nutanix CLI cmdlets to grab the new UUID ( ($HostedMachineId = Get-VM | Where {$.Name -eq "VDAName"}).UUID_ ), and using that appears to have resolved the issue.
@Jarian Gibson: I don't suppose there's a better way to go about this migration script? I was really hoping to use just Citrix's PS module to grab all of the data, and figured Nutanix's Move utility would retain the old HostedMachineId.
This is what I get for trying to work on a Saturday. I have no idea how I missed this article, but James to the rescue again: https://jkindon.com/nutanix-citrix-persistent-vm-migration/
🙌 1
r
Nice one @James Kindon 🤗
🥳 1