NikhilPathak
Enthusiast
Enthusiast

How to remove the network adaptor of a VM from VCloud

For removing the network adaptor on VCloud, i am trying below commands.

$nic0 = Get-CIVM -Org "ID14434-*" | Get-CINetworkAdapter

Remove-NetworkAdapter -NetworkAdapter $nic0 -Confirm:$false

But it fails with an error

Remove-NetworkAdapter : Cannot bind parameter 'NetworkAdapter'. Cannot convert the "Network adapter 0" value of type "VMware.VimAutomation.Cloud.Impl.V1.CINetworkAdapterImpl" to

type "VMware.VimAutomation.ViCore.Types.V1.VirtualDevice.NetworkAdapter".

At line:1 char:39

+ Remove-NetworkAdapter -NetworkAdapter $nic0 -Confirm:$false

Now when i try to remove it from VCenter using below command, it removes the NIC but  the network adapter still appears on VCloud

$nic0 = Get-VM -Name "NEUTRALNODE-Lo5l" | Get-NetworkAdapter

Remove-NetworkAdapter -NetworkAdapter $nic0 -Confirm:$false

Not sure if we have something similar to Remove-CINetworkAdapter

0 Kudos
1 Reply
fuyongvmw
Contributor
Contributor

I was searching for the same. Unfortunately, Remove-CINetworkAdapter is not available in the latest PowerCLI 12.3.0. 

Good news is Ansible supports such operation. But you will need to first read NICs then select the NIC id to remove. 

https://github.com/vmware/ansible-module-vcloud-director/wiki/vCD-vApp-VM-Nic

0 Kudos