jump to navigation

VMWare – Simple communication between Host and Guest January 2, 2008

Posted by xk0der in : Programming , trackback

Recently I’ve been working on a project which required VMWare as one of the component. As part of this project some sort of communication, albeit simple in nature,was required between the host and the guest machine.

Here are two simple commands, one to be run on host and one on the guest, using which you can pass simple information between the host and the guest virtual machine.

(single line command may wrap to next line … please note this)

Host machine commands:

$ vmware-cmd <path-to-machine.vmx> getguestinfo <variable>
$ vmware-cmd <path-to-machine.vmx> setguestinfo <variable> <value>

$ vmware-cmd /vmware-stuff/Ubuntu.vmx setguestinfo some_counter 12
$ vmware-cmd /vmware-stuff/Ubuntu.vmx getguestinfo some_counter

The first command, above, will set variable ’some_counter’ to value ‘12′ and the second one will fetch the value of ’some_counter’ on/from the virtual machine specified by /vmware-stuff/Ubuntu.vmx

VMWare typically identifies different virtual machines by their configuration files (.vmx)

To set/get info from other machine use the configuration file path of that virtual machine.

The above variables may be accessed on the guest (Virtual machine), in our case Ubuntu.vmx using the commands shown below (see example).

And yes! make sure the Virtual machine is powered on :)
Guest machine commands:

$ vmware-guestd --cmd 'info-set guestinfo.<variable> <value>'
$ vmware-guestd --cmd 'info-get guestinfo.<variable>'

$ vmware-guestd --cmd 'info-set guestinfo.some_counter 35'
$ vmware-guestd --cmd 'info-get guestinfo.some_counter'

Variables set in Virtual Machine (Guest) may be accessed on Host and vice-versa.

I tested this on VMWare-Server as it is free :) … hopefully and very likely the same is applicable for VMWare-Workstation.

For more hardcore scripting, you may Use Perl-SDK provided by VMWare (On windows you may use COM-SDK).

Please leave comments if you found this info helpful (or even otherwise).

– xk0der

Like this post?


1. sandrar - September 11, 2009

Hi! I was surfing and found your blog post… nice! I love your blog. 🙂 Cheers! Sandra. R.

2. Pablo Roesch - April 6, 2010

Please dont use COM-SDK, its EOL, for windows we recommend vSphere PowerCLI http://vmware.com/go/powercli easy and fun to use,,(provides ability to pipe objects)

I just posted a video about using VIX API for guest OS management, might help.

Pablo Roesch