VMware {code} Community
TomRichardson
Contributor
Contributor

VixCOM.Constants problem in VBScript

I've been trying to write some code to create snapshots of virtual machines (in VBScript). When I use the code sample from the VIX COM API Reference, I get an "Object Required: 'VixCom.Constants'" error. My main machine is Vista, but I tried the same thing on an XP machine just to make sure that wasn't the problem, and received the same error there. I can successfully created instances of VixCOM.VixLib. I also thought perhaps the API hadn't installed correctly, but if I fire up Visual Studio, I can access VixCOM.Constants without any issue. Does anyone have any suggestions on how I can resolve this? My current workaround is to get the values of all the constants from a VB progam and then hard code them into the script, which will eventually bite me, I'm sure.

0 Kudos
1 Reply
admin
Immortal
Immortal

Are you trying to run the .vbs script directly? You will need to create a .wsf script to invoke the .vbs script. This will ensure that the constants are loaded for the VBScript environment.

The sample code that ships with the VIX installer should give an example .wsf and .vbs pair of files.

0 Kudos