So, naturally, I have to make one up on a whim. So far, I got this for launching a VM...
Code: Select all
' vmtest.vbs -- VBScript test -- launch a vm
Dim vb
Set vb = CreateObject("VirtualBox.VirtualBox")
Wscript.Echo "VirtualBox version: " & vb.version
Wscript.Echo "package: " & vb.packageType
Wscript.Echo "API version: " & vb.APIVersion
Dim mch
Set mch = vb.FindMachine("new_wXP")
Wscript.Echo "Machine: " & mch.name
Dim ses
Set ses = CreateObject("VirtualBox.Session")
Dim prog
' this is where it throws a "type mismatch" exception...
Set prog = mch.launchVMProcess(ses,"gui","")
' haven't got this far...
prog.waitForCompletion(-1)
session.close()
Code: Select all
D:\virtualbox\scripts>cscript vmtest.vbs
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.
VirtualBox version: 6.1.30
package: WINDOWS_64BITS_GENERIC
API version: 6_1
Machine: new_wXP
D:\virtualbox\scripts\vmtest.vbs(23, 1) Microsoft VBScript runtime error: Type mismatch: 'launchVMProcess'
D:\virtualbox\scripts>
Here are my specs...
OS: Windows 10 (64-bit) Home 21H1 19043.1466
VirtualBox Version: 6.1.30 (as shown by running script)
API Version: 6.1 (as shown by running script)
CSCRIPT version: 5.812