I'm having an issue with a Perl VIX script that I am writing. I am connecting to a VM, I wait for the VMWare tools using VMWaitForToolsInGuest, and then I execute a VBScript. After about 15 minutes, I get an 3016 error code "VMWare Tools are not running in the guest", but if I check the VM manually, the tools are running. Does anyone have any clue as to why I might get this error if the tools are running?
Below is the code that I am using. I am able to connect to the VM before this in the same script without error. The error occurs during the last VMRunProgramInGuest.
Any help would be greatly appreciated.
Thanks,
Andy
print Time(), "Connecting to host...";
$err, $hostHandle) = HostConnect(
VIX_API_VERSION,
VIX_SERVICEPROVIDER_VMWARE_WORKSTATION,
$hostName, # hostName
0, # hostPort
$userName, # userName
$password, # password
0, # options
VIX_INVALID_HANDLE); # propertyListHandle
CheckError("HostConnect() failed");
print "Connected\n";
print Time(), "Opening VM...";
($err, $vmHandle) = VMOpen(
$hostHandle,
"$vmName");
CheckError("VMOpen() failed");
print "Opened\n";
print Time(), "Powering on VM...";
$err = VMPowerOn(
$vmHandle,
VIX_VMPOWEROP_LAUNCH_GUI, # powerOnOptions
VIX_INVALID_HANDLE); # propertyListHandle
CheckError("VMPowerOn() failed");
print "Powered on\n";
print Time(), "Waiting for tools...";
$err = VMWaitForToolsInGuest(
$vmHandle,
3600); # timeoutInSeconds
CheckError("VMWaitForToolsInGuest() failed");
print "Ready\n";
print Time(), "Logging in as $userName...";
$err = VMLoginInGuest(
$vmHandle,
$userName, # userName
$password, # password
0); # options
CheckError("VMLoginInGuest() failed");
print "Logged in\n";
$err = VMRunProgramInGuest(
$vmHandle,
$cscript, #executable
"$vmTestsDir\\runAnt.vbs $vmTestsDir\\build.xml $buildTarget", #arguments
0, # options
VIX_INVALID_HANDLE);
CheckError("VMRunProgramInGuest(JUnit tests) failed");
print "Finished\n";