One way to execute remote commands on a running VMware VM is by using RbVmomi. It’s a Ruby wrapper for VMware’s SOAP API.
RvVmomi is not installed on the appliance by default, but can be easily added:
1gem install rbvmomi
To make this work, the VMware Tools have to be installed and running inside the virtual machine. You also need the credentials to log into the virtual machine.
An example method on how to use this library can be found on my Github page.