Hello,
I am using the following PERL script against a WS 5.5.1 build 18463 installed on WinXP. VMPowerOn has always been failing for me with error "3008 Cannot connect to the virtual machine". I have tried all sorts of combinations, keeping WS already open/not open, the VM inside it open/not open, etc. I also looked up some discussions already on this site but it just wont work for me. Could you please help me get it working?
All steps before VMPowerOn succeed. (Note that the code below appears messed in some places after posting to this site but basically all syntax is correct on my machine and its a working script.)
Please find the logs below.
Thanks
adive
-
my $vmFullPath = "E:
VMs
WinXP
WinXPPro.vmx";
use VMware::Vix::Simple;
use VMware::Vix::API::Constants;
my $err = VIX_OK;
my $hostHandle = VIX_INVALID_HANDLE;
my $vmHandle = VIX_INVALID_HANDLE;
my $powerOnOption = VIX_VMPOWEROP_NORMAL; # VIX_VMPOWEROP_LAUNCH_GUI;
connect to the host VMware server layer (Workstation/VMware Server)
print "Attempting to connect to the VMware Workstation host...\n";
($err, $hostHandle) = HostConnect(VIX_API_VERSION,
VIX_SERVICEPROVIDER_VMWARE_WORKSTATION, #VIX_SERVICEPROVIDER_DEFAULT, #
VIX_SERVICEPROVIDER_VMWARE_SERVER
undef, # hostName
0, # hostPort
undef, # userName
undef, # password
0, # options
VIX_INVALID_HANDLE); # propertyListHandle
die "HostConnect() failed, $err ", GetErrorText($err), "\n" if $err != VIX_OK;
...Do everything in your program...
print "Connected successfully\n";
print $vmFullPath;
print "\n\n";
print "Attempting to open ";
print "\n";
($err, $vmHandle) = VMOpen($hostHandle, $vmFullPath);
die "VMOpen() failed, $err ", GetErrorText($err), "\n" if $err != VIX_OK;
print "Opened VM successfully\n";
print "Attempting to power on the VM\n";
$err = VMPowerOn($vmHandle,
powerOnOption, # 0, # VIX_VMPOWEROP_LAUNCH_GUI, # powerOnOptions
VIX_INVALID_HANDLE); # propertyListHandle
die "VMPowerOn() failed, $err ", GetErrorText($err), "\n" if $err != VIX_OK;
print "Powered on successfully\n";
ReleaseHandle($vmHandle);
HostDisconnect($hostHandle);
-
Logs:
Nov 01 17:33:59.130: app| Log for Vix pid=2068 version=2 build=build-45731 option=Release
Nov 01 17:33:59.130: app| Hostname=dearcreek
Nov 01 17:33:59.130: app| Foundry Init: setting up global state (0 threads)
Nov 01 17:33:59.426: app| HOSTINFO: Seeing Intel CPU, numCoresPerCPU 1 numThreadsPerCore 2.
Nov 01 17:33:59.426: app| HOSTINFO: numPhysCPUs is 0, bumping to 1.
Nov 01 17:33:59.426: app| HOSTINFO: numCores is 0, bumping to 1.
Nov 01 17:33:59.426: app| HOSTINFO: This machine has 1 physical CPUS, 1 total cores, and 1 logical CPUs.
Nov 01 17:33:59.630: app| VMHS: Failed to load vmnetMgr.dll
Nov 01 17:33:59.630: app| Foundry Init: version 2, hostType 3, hostName (null), hostPort 0, options 0x0
Nov 01 17:33:59.645: app| CreateFile on pipe
.\pipe\E:\VMs\WinXP\WinXPPro.vmx failed 2.
Nov 01 17:33:59.661: app| Using 'C:\Program Files\VMware\VMware Workstation\vmware.exe' as path to GUI
Nov 01 17:34:09.692: app| CreateFile on pipe
.\pipe\E:\VMs\WinXP\WinXPPro.vmx failed 2.
Nov 01 17:34:20.755: app| CreateFile on pipe
.\pipe\E:\VMs\WinXP\WinXPPro.vmx failed 2.
Nov 01 17:34:31.817: app| CreateFile on pipe
.\pipe\E:\VMs\WinXP\WinXPPro.vmx failed 2.