Connect vNIC on a VM to network using command line

Once upon a time I had an ESXi host in disconnected state and the management services were out of order and even restarting management services couldn’t help out to get it back to manageable state.

While the Host was partially manageable we had to connect a network interface of a VM to network but the only option was command line. The below commands did the job:

You will need to find the VM ID and the vNIC device ID as well using the below two commands:

vim-cmd vmsvc/getallvms | grep "VM_Name"
vim-cmd vmsvc/get.configuration "VM_ID"

Then you can run the below command to connect/disconnect the vNIC:

vim-cmd vmsvc/device.connection true|false

example:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close