Hi Experts
I have a script to simple vMotion a VM between vDS portgroup and NSX-T Opaque Network
See script below
The error happen during the Move-VM operation
Move-VM -vm $VM -Destination $destination -NetworkAdapter $networkAdapter -Network $destinationNSXPortGroup
I have filtered the Opaque network so itchnically it should do the job but it dosent can i get some help please
PS C:\> $destinationNSXPortGroup
Name NetworkType
---- -----------
Sample-VLAN-600-XX-VMN Opaque
Error
PS C:\> Move-VM -vm $VM -Destination $destination -NetworkAdapter $networkAdapter -Network $destinationNSXPortGroup
Move-VM : 16-9-2021 12:43:22 Move-VM The operation for the entity "NSXmigtst001" fai
led with the following message: "Currently connected network interface 'Network adapt
er 1' cannot use network 'OTA-VLAN-633-BB-VMN (nsx.LogicalSwitch:15d096f6-0527-4c6b-9
5de-ff73eefdb7a0)', because the type of the destination network is not supported for
vMotion based on the source network type.". See KB article 56991 for more details.
At line:1 char:1
+ Move-VM -vm $VM -Destination $destination -NetworkAdapter $networkAda ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Move-VM], CannotUseNetwork
+ FullyQualifiedErrorId : Client20_TaskServiceImpl_CheckServerSideTaskUpdates_Op
erationFailed,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveVM
###################################################################
Foreach ($VMdetail in $VMdetails) {
$VM = Get-VM -Name $VMdetail.VMNAME -ErrorAction SilentlyContinue
If ($VM) {
Write-Host "VM ==> $VM is a alive on the source VC ==>$global:DefaultVIServer" -ForegroundColor Yellow
}
Else {
Write-Host 'VM' $VMdetail.VMNAME' Cannot be found' -ForegroundColor Magenta
continue
}
# End the loop
#}
####################################################################################################################################
# Check if there is a Destination ESXi host on the specified cluster
# If found proceed or skip to next record
####################################################################################################################################
$destination = Get-cluster $vmdetail.ClusterNSXT -ErrorAction SilentlyContinue |Get-VMHost -Name $VMdetail.ESXiNSXT
if ($destination){
Write-Host "VM will be placed on ESXi host ==>" -ForegroundColor Yellow $destination
}
Else {
Write-host "Destination ESXi host" $vmdetail.ClusterNSXT "is not Accessible" -ForegroundColor Magenta
continue
}
# End loop
# }
######################################################
## Check if the Network Adapter for the VM is found ##
## If found proceed or skip to next record ##
######################################################
$networkAdapter = Get-NetworkAdapter -vm $VM -ErrorAction SilentlyContinue
If ($networkAdapter){
Write-Host "VM Network Adaptor info ==>$networkAdapter" -ForegroundColor Yellow
}
Else {
Write-Host "Network Adpater cannot be attahced and migration will fail" -ForegroundColor Magenta
continue
}
# End loop
# }
#########################################################################################
## Check if the destination NSXT Portgroup is available, also check if the destination ##
## NetworkAdapteNSXT PortGroup is found, if unavailable skip to the next record ##
#########################################################################################
$destinationNSXPortGroup = Get-VirtualNetwork -name $VMdetail.PortGroupNSXT |where {$_.networktype -eq "Opaque"} -ErrorAction SilentlyContinue
If ($destinationNSXPortGroup){
Write-Host "VM will be moved to following PortGroup ==>$destinationNSXPortGroup " -ForegroundColor Yellow
}
Else {
Write-Host "NSX-T Overlay Switch or PortGroup cannot be found " -ForegroundColor Magenta
continue
}
####################################################################################################################################
# Move VM
# Change Network Adapter
#
####################################################################################################################################
Move-VM -vm $VM -Destination $destination -NetworkAdapter $networkAdapter -Network $destinationNSXPortGroup
}
############################################################################################