Unable to connect to VMWare Workstation

May 5, 2010 at 7:25 PM
Edited May 5, 2010 at 7:27 PM

I've been having difficulty attaching to VMWare Workstation w/ VMWareTasks. The code below worked at one time, but no longer does.

I am running: VMWARE Workstation 6.52,  Powershell V2,  Latest VMWareTasks,  and VIX 1.8.

Here the code snippet which is failing to connect:

$vestrisDir = "C:\vestris.vmwaretasks\"
add-type -path "$vestrisDir\1.4\Bin\Vestris.VMWareLib.dll"
add-type -path "$vestrisDir\1.4\Bin\Interop.VixCom.dll"
$myHost = new-object vestris.vmwarelib.vmwarevirtualhost
$myHost.ConnectToVMWareWorkstation
The connection attempt returns no errors.  But if I check the "isConnected" property it returns False.
Here is my VIX log:
Apr 05 02:41:07.478: app| Log for Vix pid=3004 version=-1 build=build-156735 option=Release
Apr 05 02:41:07.478: app| Host codepage=windows-1252 encoding=windows-1252
Apr 05 02:41:07.479: app| Foundry Init: setting up global state (0 threads)
Apr 05 02:41:07.479: app| Vix_InitializeGlobalState: Use Preference. vixLogLevel = 0
Apr 05 02:41:07.479: app| Vix_InitializeGlobalState: vixDebugPanicOnVixAssert = 0
Apr 05 02:41:07.479: app| Vix_InitializeGlobalState: vixLogRefcountOnFinalRelease = 0
Apr 05 02:41:07.875: app| HOSTINFO: Seeing Intel CPU, numCoresPerCPU 2 numThreadsPerCore 1.
Apr 05 02:41:07.875: app| HOSTINFO: This machine has 2 physical CPUS, 4 total cores, and 4 logical CPUs.
Apr 05 02:41:08.733: app| LOCALE windows-1252 -> NULL User=409 System=409
Apr 05 02:41:08.741: app| VixHost_ConnectEx: version -1, hostType 1, hostName (null), hostPort 0, options 512
Apr 05 02:41:08.742: app| VMListReg::Listener - Initial registry scan completed.

Thank you for any assistance you may be able to provide.

 

Coordinator
May 6, 2010 at 12:11 AM

I don't see anything wrong here, clearly it tries to make a connection and seems to do something.

What happens if you try to, for example, find and power on a VM?

May 6, 2010 at 4:22 AM

I'm hesitant to admit this, but I was missing some parentheses calling the connect method. 

 

$myHost.ConnectToVMWareWorkstation

Should be:

$myHost.ConnectToVMWareWorkstation()

Powershell doesn't make big use of parentheses or semicolons, so I got out of the habit of using them!

P.S. - I'm really enjoying the wrapper, it's quite a bit easier than using VIX directly.  Thanks for writing it!

Coordinator
May 12, 2010 at 12:52 PM
Nimicohgr wrote:

I'm hesitant to admit this, but I was missing some parentheses calling the connect method. 

No problem. I am glad it turned out to be a non-event. We don't judge :) Don't forget to reply to Are you using VMWareTasks?

May 12, 2010 at 3:19 PM

My company, Symantec, is already up there.  Looks like 3 departments decided to independently use your library.  :)