VMware Cloud Community
smccreadie
Enthusiast
Enthusiast

Trying to use vmware-cmd getconfig / connectdevice to no avail

I've seen some similart posts regarding this, but I haven't been able to fix my issue.

The goal is to have a VM with 2 NIC's, one enabled the other disabled. This quick command should be able to turn the other NIC on (and keep that change persistent).

Only a few of the commands with vmware-cmd seem to work ie, getstate, etc. This does not work, and I can not figure out why:

vmware-cmd /vmfs/volumes/VirtualMachines/SR-BH-BLACKBERRY/SR-BH-BLACKBERRY.vmx disconnectdevice ethernet0

I get: VMControl error -5: Not connected

The device in the vmx file is "ethernet0". I've tried "Ethernet0", etc, but nothing works. Any suggests or other approaches to what I need to do?

Reply
0 Kudos
6 Replies
Texiwill
Leadership
Leadership

Hello,

vmware-cmd has issues with the getconfig calls, they do not work. You should look at using vimsh instead. Check out http://www.xtravirt.com/index.php?option=com_remository&Itemid=75&func=fileinfo&id=4 for help. Or the scripting API.

Best regards,

Edward L. Haletky, author of the forthcoming 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', publishing January 2008, (c) 2008 Pearson Education. Available on Rough Cuts at http://safari.informit.com/9780132302074

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
Reply
0 Kudos
SomeoneSomewher
Contributor
Contributor

I had this problem also and even though vmnet0 is in the config file as "ethernet0" vmware-cmd wants Ethernet0 with a captital E ????

Hope this helps someone.

Reply
0 Kudos
SomeoneSomewher
Contributor
Contributor

I had this problem also, it turned out vmware-cmd wanted ethernet0 with a captial "E", so,

vmware-cmd "path-to-config.vmx" connectdevice Ethernet0

Works?????

Reply
0 Kudos
lamw
Community Manager
Community Manager

What you could have done is to search for the "Etherenet0" string and parse that out, this will give you the exact case, then take that output and pass it into your connectdevice

grep -i "ethernet" "path-to-config.vmx"

From there, you can awk/sed out the exact value you want, and then pass it into your connectdevice command. You can also use vimsh as others have suggested, that internal shell is also very powerful and depending on whether you're pre 3.5 (vimsh) and 3.5u1 (vmware-vim-cmd)

Reply
0 Kudos
SomeoneSomewher
Contributor
Contributor

That wasn't the problem on mine the vmx file lists the ethernet device as ethernet0 but the command only worked if you used a capital E despite the case in the vmx file. I am quite familiar with the linux command line interface and run all my vms with a server installation and without a gui, it is vmware-cmd which seems to be at fault.

Reply
0 Kudos
lamw
Community Manager
Community Manager

Oh that's very interesting, I have not ran this specific command to connectdevice, but I'm surprised they're forcing it to be a specific case. In that case there's really nothing you can do but just grep out the "ethernet" value and turn the "e" to upper case before passing it in to the command.

Reply
0 Kudos