Announcing Guest Operating System Management API for vSphere
Having created a sample to run a program in guest operating system using GuestProgramManager, I started to write a similar one to show how to use the GuestFileManager. Compared with the GuestProgramManager, the GuestFileManager is much more complicated to use.
So I decided to take time to develop a high-level guest management API on top of the existing VI Java API. Besides the existing features offered by the vSphere API itself, I also added new features like uploading and downloading a whole directory (vSphere API itself only supports uploading and downloading a single file), uploading and downloading file to and from Java stream. The stream support is very important for an API, not much so for a command line tool.
The core of the guest opermanagement API for vSphere is two classes: GuestProgramDirector and GuestFileDirector, which corresponds to the GuestProgramManager and GuestFileManager. The names are consistent with the fact that a director is high level to a manager.
The usage of the APIs is straight-forward. The methods, especially those in the GuestFileDirector, are pretty similar to what you do with conventional command lines. For example, the downloadFile method has the following signature. I think you can guess out how to use this method easily.
public void downloadFile(String filePathInGuest, String filePathLocal) throws IOException
I will explain more about each of the types with samples in future blogs. Here is the API for you to download.
Update: sample 1: run, kill, and list programs in guest operating system.

Hi,
i have downloaded the API and copied your code to run, kill process.
Its throwing a null pointer exception at line 30 of the GuestProcessDirector.java.
What would be the error?
I am new to Java. Please deal with this solution.
GuestProcessDirector progDir = new GuestProcessDirector(vm, “Administrator”, “vijava”);
The VM object , user name and password are valid here.
My vmware tools version is 8.3.2, build 257589….Should i upgrade?
It should be newer. In my case, the version is 8.6.0 build 425873.
Steve
Can you share your ESX details? Can you please specify the minimum requirements ?
my ESX is 4.0
Is there any particular reason why this API is not part of the VI Java API? Using the link provided here I am downloading five .class java files and was wondering whether there exists such files packaged in a jar. Thanks
This is awesome. Can you put this in maven central?