VMWareTasks: reading RunProgramInGuest command output

Jun 22, 2010 at 5:05 PM

I'm currently struggling to understand what's explained on the page:

http://code.dblock.org/ShowPost.aspx?id=78

  ... about how to capture, and return to the host, the output of a command run in the guest windows OS.

 

Has someone used this in a project and can explain it to me?

I already have Vestris.VMwarelib added as a reference to my Visual Studio C# project, and have

Using Vestris.VmwareLib;

in my code.

   When I try using

Vestris.VMWareLib.Tools.Windows.Shell.RunCommandInGuest,

as mentioned in the narrative on the above mentioned page, I'm advised that there is no type or namespace "Tools" in that context.

The 'Shell' object is mentioned in the compiled help reference file, but do I need to add a reference somehow to the VS environment?

A concrete example might help.

 

Thanks

 

Coordinator
Jun 22, 2010 at 5:11 PM

Add a reference to Vestris.VMWareTools.dll along with an existing Vestris.VMWareLib.dll.

Add a using like this.

using Vestris.VMWareLib.Tools.Windows;

Provided you have a VirtualMachine object to a powered and logged-into virtual machine, write, for example:

Shell guestShell = new Shell(virtualMachine);
Shell.ShellOutput output = guestShell.RunCommandInGuest("echo hello world");
Console.WriteLine(output.StdOut);