How to change the network adapter of a vm using a cli in esxi

command-line-interfacenetworkingvmware-esxivmware-vsphere

I want to change the network adapter of a guest virtual machine using esxcli, vcli or any other cli means.

I couldn't find an esxcli command, which is expected as its scope is primarily the host.

I installed vcli on a Windows 7 system and tried vmware-cmd but it has another function (connect/disconnect) and I even couldn't make that work.

I haven't tried PowerCLI Cmdlets nor editing the vmx file directly (as this would have unexpected results on a running vm, I assume) yet.

I couldn't find any other commands to perform this simple task.

I'm interested in solutions on both, Linux and Windows — or some Linux command that also runs on cygwin or similar.

Best Answer

I am not sure why you have not tried using PowerCLI, that would be the easiest and fastest way to do that. You can change the network adapter from connected to disconnected, change the network label (vLAN), or remove it all together. From all the times I have used this I have not come across any adverse effects on the VM's.