Hacking VMware Tools ISO from vSphere

In a recent experiment, I needed to get the VMware Tools installer. Somehow after searching many different places, I couldn’t find it. While writing this article, I found a link to all the installers organized per ESX versions and CPU architectures. The installers are single files, different from an installable CD which I hacked.

Update: after this blog was published, William and Brad (see comment) pointed out that all the iso images can be copied out of ESXi directly. I tried it with WinSCP and it worked nicely. This is definitely easier way to go and you can get all the ISO files once assuming you have permission to ESXi. If you don’t have permission, read on.

Bothered by SLOW Web UI to manage vSphere? Want to manage ALL your VMware vCenters, AWS, Azure, Openstack, container behind a SINGLE pane of glass? Want to search, analyze, report, visualize VMs, hosts, networks, datastores, events as easily as Google the Web? Find out more about vSearch 3.0: the search engine for all your private and public clouds.

It’s in fact easy to install the VMware Tools in a virtual machine running on vSphere. In a vSphere Client, you can select a virtual machine and right click on it. Just pick Guest – Install/Upgrade VMware Tools context menu item. After a few seconds, you see the following AutoPlay dialog box in the OS. You can choose “Run setup.exe” which kicks out the installation process.

I actually chose “Open folder to view files,” and opened up a file explorer like the following:

Notice that the file explorer actually shows the D drive. Behind the scene, the virtual machine connects to a VMware Tools ISO file as shown below in its Property dialog box.

As you can see, the ISO file the virtual machine mounts to is as follows:

[] packages/4.1.0/vmtools/windows.iso

This is a well-know datastore ISO file that is hidden to any users. It’s not a valid datastore ISO file path you can mount as others though. If you work in a Linux machine, you may be mounted something like linux.iso instead. The vSphere is just smart enough to get it done for you.

If you have previously mounted another ISO, it’s temporarily replaced by the VMware Tools ISO. But don’t worry – it will be back after you right click the VM in vSphere Client and choose Guest – End VMware Tools Install context menu item.

Now, get back to our topic. Once you have the windows.iso mounted to the Windows. You can simply copy all the files from there, and send them to wherever you want like a directory.

Once you’ve done that, you can simple use an ISO creation tool to create an ISO file from the directory. I use ISO Recorder 3.1 by Alex Feinman. It has nice integration with file explorer. This created ISO file of VMware Tools for Windows is about 50M in size. You can copy this ISO to a datastore and mount it as any other ISO files, even though it’s really not needed.

Check out this wiki page for other freeware/sharewares that can do ISO creations.

This entry was posted in Virtualization and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

10 Comments

  1. Brad C
    Posted December 9, 2011 at 11:32 am | Permalink

    You’re doing it the hard way. The iso files are on every host, just copy them off. In ESXi 4.1 they’re at /vmimages/tools-isoimages/

  2. Posted December 9, 2011 at 12:15 pm | Permalink

    Thanks Brad, you are absolutely right. William Lam pointed that out as well. I will update the blog shortly.
    Steve

  3. shluvme
    Posted August 14, 2013 at 10:49 am | Permalink

    I would like to know what actions are performed on the esx in order to mount the iso ?

    I’m writing an extension for the vsphere client which is similar to vmware’s ‘install vmtools’ just in my case i want to install other applications but in the same manner.

    thanks

  4. Posted August 23, 2013 at 6:39 pm | Permalink

    You can use the reconfigVM_Task() method to add a CD drive to the virtual machine of your interest.

    http://vijava.sourceforge.net/vSphereAPIDoc/ver51/ReferenceGuide/vim.VirtualMachine.html#reconfigure

    Steve

  5. shluvme
    Posted October 16, 2013 at 6:43 am | Permalink

    Thanks Steve !
    I actually had implemented what you recommended without seeing your answer (^_^).
    However, I have encountered a new problem. Instead of mounting the ISO and letting autorun do the work, I want to silently install the application by running ‘msiexec …’ so the challenges I face now involve the StartProgramInGuest API, I can’t seem to get the moref to “GuestAuthManager”.
    Do you have any clue on how to do that ?

    I’ve pasted my code for reference:

    ManagedObjectReference guestOpManager =
    _extendedAppUtil.getServiceConnectionV25().ServiceContent.guestOperationsManager;
    _extendedAppUtil.getServiceUtilV25().GetDecendentMoRef()
    ManagedObjectReference guestAuthManager = new ManagedObjectReference();
    guestAuthManager.type = "GuestAuthManager";
    guestAuthManager.Value= "GuestAuthManager";

    NamePasswordAuthentication namePasswordAuth = new NamePasswordAuthentication();
    namePasswordAuth.username = "test";
    namePasswordAuth.password = "test";

    GuestAuthentication guestAuthentication =
    _extendedAppUtil.getServiceConnectionV25().Service.AcquireCredentialsInGuest(
    guestOpManager,
    virtualMachine,
    namePasswordAuth,
    0,
    false);

    GuestProgramSpec programSpec = new GuestProgramSpec();
    programSpec.programPath = "C:\\windows\\system32\\calc.exe";

    _extendedAppUtil.getServiceConnectionV25().Service.StartProgramInGuest(guestOpManager, virtualMachine, guestAuthentication, programSpec);

    _extendedAppUtil.getServiceConnectionV25().Service.ReleaseCredentialsInGuest(guestAuthManager,virtualMachine,guestAuthentication);

    In the above code the call to AcquireCredentialsInGuest fails.
    Any idea’s ?

    Thanks !
    Shluvme

  6. Posted October 16, 2013 at 9:22 am | Permalink

    I don’t know how it’s implemented in the _extendedAppUtil, but it seems there is a bug with vSphere that the GuestOperationManager object moRef is returned null.

    Steve

  7. shluvme
    Posted October 17, 2013 at 3:18 am | Permalink

    do you think the regular vim api (not vim25) is buggy as well ?

  8. Posted October 17, 2013 at 10:38 am | Permalink

    The vim25 is vim essentially. VMware used to use namespace to version the APIs, therefore you see vim and vim25. But it then decided to use SOAP_ACTION To version the APIs and vim25 stays forever.

    Steve

  9. shluvme
    Posted October 23, 2013 at 7:16 am | Permalink

    Well I’m writing a vsphere client plugin and I need to find a way to install software silently on a VM from the the plugin. I’ve taken a look at the VI Toolkit for .NET at http://vitfordotnet.sourceforge.net/ but it doesn’t seem to support the option of creating a process in a VM.
    Under the assumption that this project needs to be coded in C#, any idea’s how I could get this done ?

  10. Posted October 23, 2013 at 10:48 am | Permalink

    The guest OS command support (or VIX) has been in vSphere API since 5.0. You should be able to use it directly from Web Services API. The VI Toolkit for .NET may have not been updated to 5.0 or later. You may want to contact the author for help.

    Good luck!

    Steve

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  • NEED HELP?


    My company has created products like vSearch ("Super vCenter"), vijavaNG APIs, EAM APIs, ICE tool. We also help clients with virtualization and cloud computing on customized development, training. Should you, or someone you know, need these products and services, please feel free to contact me: steve __AT__ doublecloud.org.

    Me: Steve Jin, VMware vExpert who authored the VMware VI and vSphere SDK by Prentice Hall, and created the de factor open source vSphere Java API while working at VMware engineering. Companies like Cisco, EMC, NetApp, HP, Dell, VMware, are among the users of the API and other tools I developed for their products, internal IT orchestration, and test automation.