Home > Virtualization > Hacking VMware Tools ISO from vSphere

Hacking VMware Tools ISO from vSphere

December 9th, 2011 Leave a comment Go to comments

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.

Time to learn how to "Google" and manage your VMware and clouds in a fast and secure

HTML5 App

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.

Categories: Virtualization Tags: , ,
  1. Brad C
    December 9th, 2011 at 11:32 | #1

    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. December 9th, 2011 at 12:15 | #2

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

  3. shluvme
    August 14th, 2013 at 10:49 | #3

    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. August 23rd, 2013 at 18:39 | #4

    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
    October 16th, 2013 at 06:43 | #5

    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. October 16th, 2013 at 09:22 | #6

    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
    October 17th, 2013 at 03:18 | #7

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

  8. October 17th, 2013 at 10:38 | #8

    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
    October 23rd, 2013 at 07:16 | #9

    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. October 23rd, 2013 at 10:48 | #10

    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

  1. No trackbacks yet.