the problem with vmrun was that the version of my VMWare Workstation was not in the vixwrapper-config.txt included so i had to add it
# Workstation 7.0.0
ws 9 vmdb 7.0.0 Workstation-7.0.0
ws 9 vmdb 7.0.1 Workstation-7.0.0
ws 9 vmdb e.x.p Workstation-7.0.0
player 9 vmdb 3.0.0 Workstation-7.0.0
player 9 vmdb e.x.p Workstation-7.0.0
after that vmrun works
when i try to run the script with the wsf it works (the constants taken from the vix api)
when i try to run the script with the extracted constants i get an runtime error invalid procedure call or invalid argument
by the way api_version should be -1 in the script
Dim lib
Dim host
Dim vm
Dim err
Dim results
Dim job
Const JOB_RESULT_HANDLE =3010
Const VMPOWEROP_LAUNCH_GUI=512
Const API_VERSION=-1
Const SERVICEPROVIDER_VMWARE_WORKSTATION=3
Set lib = CreateObject("VixCOM.VixLib") ' instantiate a COM object
' use obtained COM object
Set job = lib.Connect(API_VERSION, SERVICEPROVIDER_VMWARE_WORKSTATION, Empty, 0, Empty, Empty, 0, Nothing, Nothing)
' results needs to be initialized before it's used, even if it's just going to be overwritten.
Set results = Nothing
err = job.Wait(Array(JOB_RESULT_HANDLE), results)
If lib.ErrorIndicatesFailure(err) Then
QuitIfError(err)
End If
Set host = results(0)
Set job = host.OpenVM("d:\virtual machines\windows server 2003 enterprise edition\windows server 2003 enterprise edition.vmx", Nothing)
err = job.Wait(Array(JOB_RESULT_HANDLE), results)
If lib.ErrorIndicatesFailure(err) Then
QuitIfError(err)
End If
Set vm = results(0)
Set job = vm.PowerOn(VMPOWEROP_LAUNCH_GUI, Nothing, Nothing)
err = job.WaitWithoutResults()
If lib.ErrorIndicatesFailure(err) Then
QuitIfError(err)
End If
'--------------------------------------------------------------------------------
' A simple error handler. Prints the error message to the console, and then exits.
sub QuitIfError(err)
if lib.ErrorIndicatesFailure(err) then
WScript.Echo("Error: " & lib.GetErrorText(err, empty))
WScript.Quit
end if
end sub