View Only
  • 1.  New-HCXMigration failure

    Posted Jul 31, 2023 03:29 PM

    So, working up a hcx migration script for my environment, its failing in a very weird way.  The migration type doesn't match from new-hcxmigration to set-hcxmobilitygroup. And I have no idea how they could be different:

    $NewMigration = New-HCXMigration -VM $HCXvm -MigrationType RAV -SourceSite $HcxSrcSite -DestinationSite $HcxDstSite `
    -TargetComputeContainer $DstCompute -TargetDatastore $DstDatastore -NetworkMapping $NetworkMapping `
    -UpgradeVMTools $False -RemoveISOs $False -ForcePowerOffVm $False -RetainMac $True -UpgradeHardware $False `
    -RemoveSnapshots $False -ScheduleStartTime $startTime -ScheduleEndTime $endTime `
    -ReplicateSecurityTags $True -MigrateCustomAttributes $True

    Test-HCXMigration -Migration $NewMigration

    Set-HCXMobilityGroup -MobilityGroup (Get-HCXMobilityGroup | where {$_.Name -like "*$MobilityGroupName*"}) -Migration $NewMigration -addMigration

    Set-HCXMobilityGroup : Cannot bind parameter 'Migration'. Cannot convert the "RAV" value of type "VMware.VimAutomation.Hcx.Impl.V1.HCXMigrationImpl" to type
    At C:\Users\503012552z\Documents\Scripts\HCXtest.ps1:113 char:118
    + ... .Name -like "*$MobilityGroupName*"}) -Migration $NewMigration -addMig ...
    + ~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Set-HCXMobilityGroup], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,VMware.VimAutomation.Hcx.Commands.Cmdlets.SetHCXMobilityGroup

    The migration group is already set to type RAV, as confirmed in the GUI. And the new-hcxmigration will fail without the type set.

    Those two types being different just seems off?

  • 2.  RE: New-HCXMigration failure
    Best Answer

    Posted Jul 31, 2023 04:40 PM

    Turns out there's an extra switch to make it work.