How to install VMWareTasks for usage via vbscipt?

Mar 24, 2011 at 5:22 PM
Edited Mar 24, 2011 at 5:24 PM

Can someone please help me to install VMWareTasks so I can use it via vbscript?

The documentation on this seems to be wrong (the mentioned dll-names do not exist) and I am not sure

how to register the dlls for my x64bit Windows 7. Till now I had no success to run the demo-vbscript at all.

Any help would be really appreciated.

Mar 24, 2011 at 5:34 PM
Edited Mar 24, 2011 at 5:36 PM

This is my script to register the dlls and to launch the sample-code, which is NOT working (seee last lines of code):

I launched it via a 64bit dos-prompt, but even from the 32bit dos-prompt it is not working.

 

const HKLM = &H80000002
Set reg=GetObject("winmgmts:\\.\root\default:StdRegProv")
Set fso = CreateObject("Scripting.FileSystemObject")
Set WsShell = Wscript.CreateObject("WScript.Shell")
scriptpath = fso.GetFile(wscript.ScriptFullName).ParentFolder

reg.GetStringValue HKLM,"SOFTWARE\Microsoft\.NetFramework","InstallRoot",InstallRoot
InstallRoot = InstallRoot  & "v2.0.50727\"
WsShell.CurrentDirectory = InstallRoot

WsShell.run("regasm.exe /codebase """ & scriptpath & "\Vestris.VMWareComLib.dll"" /tlb:VMWareComLib.tlb"),0,true
WsShell.run("regasm.exe /codebase """ & scriptpath & "\Vestris.VMWareTools.dll"" /tlb:VMWareTools.tlb"),0,true

' Example: Getting Started (Workstation)
' declare a Virtual Host
WSCript.Echo "Creating VMWareComLib.VMWareVirtualHost"
set virtualHost = CreateObject("VMWareComLib.VMWareVirtualHost")
' connect to a local VMWare Workstation virtual host
WSCript.Echo "Connecting to VMWare Workstation"

virtualHost.ConnectToVMWareWorkstation()
'the last code-line ends with the following error-message:
'test.vbs(20, 1) Vestris.VMWareLib: Retrieving the COM class factory for compone
'nt with CLSID {6874E949-7186-4308-A1B9-D55A91F60728} failed due to the following
' error: 80040154.

Coordinator
Mar 24, 2011 at 7:00 PM

Try running those regasm commands manually. Are there any errors? What's the output?

Mar 26, 2011 at 12:34 PM

The REGASM is not showing any errors except a warning to use "strong names".

But could it be possible that there is just a missing dll in the package?

The documentation is referencing a VMWareComTools.dll (incl. "COM" in the name ) but I can only find the VMwareTools.dll.

Coordinator
Mar 26, 2011 at 1:03 PM
Edited Mar 26, 2011 at 1:04 PM

Oh it's a 64-bit machine! On 64-bit you have to run 32-bit CSCript, from "%WINDIR%\SysWOW64\Cscript.exe". 

The next thing to do is to get OleView and see if things are registering properly (look for Vestris.... under All Objects). You can expand the VMWareVirtualHost object from there and hopefully get a better error.

Mar 26, 2011 at 1:21 PM

Thanks for the very fast response!

I have tested everything on a pure 32bit XP machine and everything is working fine there.

From my point of view it looks like an installer-problem of the VIX itself because the above GUID from the error

points to the VixCOM.dll but inside of the "Program Files (x86)"-folder which does not exist inside the SysWOW6432-subsystem.

I will try the OleView and the depends.exe-Tool from MS to find some more info.

Coordinator
Mar 26, 2011 at 1:22 PM

You're right about the missing VMWareComTools.dll, it's missing. Pickup a 1.6 build, it's there now.

Coordinator
Mar 26, 2011 at 1:25 PM
cgiese wrote:

Thanks for the very fast response!

I have tested everything on a pure 32bit XP machine and everything is working fine there.

From my point of view it looks like an installer-problem of the VIX itself because the above GUID from the error

I got a 64-bit Windows 7 where I can run everything, provided I use a 32-bit cscript.exe. Nothing special about my command prompt or installation. VixCOM 1.10.2.