You can create a directory, create files, copy a script, and run the script on a guest operating system.

Before you perform operations on the guest operating system, you must prepare the environment. You must create the Process.CreateSpec for initiating processes in the guest and create the Transfer.CreateSpec for the file transfer to or from the guest. The content of the optional FileAttributeCreateSpec associated with the Transfer.CreateSpec establishes the direction of the transfer and controls guest operating system specific file attributes. You must set up equivalent _download and _upload functions for URL management of the file transfer to or from the guest. You can also create an argument parser for standard inputs, such as server, user name, and password, and you can add custom input arguments.

Procedure

  1. Find the virtual machine on which the guest operating system runs, verify that VMware Tools is running, and provide credentials.
  2. Create a temporary directory from which to run the script and capture any output.
  3. Create temporary files for stdout and stderr.
  4. (Optional) Copy the script that you want to run.
  5. Start the script and capture stdout and stderr in the temporary files that you created earlier.
  6. Create a loop to handle processes that run longer.
  7. Create a download URL and copy the results.
  8. Clean up the temporary files and directories on the guest operating system.