VMware {code} Community
Fluffy08
Contributor
Contributor

Strange behaviour

Hi all,

i have some quite strange behaviour here:

I used autoit to automate a

setup. I copy the files to the VM and the use this code to run the setup:

VixCOM.IJob job = null; VixCOM.IVM VM = null; VixCOM.IVixLib lib = null; lib = new VixCOM.VixLib(); int[] propertyIDs = new int[1]; Console.WriteLine("Connecting..."); job = lib.Connect(VixCOM.Constants.VIX_API_VERSION, VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_WORKSTATION, "", 0, "", "", 0, null, null); object results = null; object[] resultsArray = (object[])results; propertyIDs[0] = VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE; handleError("Setup Error:", job.Wait(propertyIDs, ref results), lib); resultsArray = (object[])results; //get our host VixCOM.IHost host = (VixCOM.IHost)resultsArray[0]; //open VM Console.WriteLine("Opening Virtual Machine"); job = host.OpenVM(vmPath, null); handleError("OpenVM Error:", job.Wait(propertyIDs, ref results), lib); resultsArray = (object[])results; //get VM VM = (VixCOM.IVM)resultsArray[0]; Console.WriteLine("Logging in user..."); job = VM.LoginInGuest("Cord", "cord", VixCOM.Constants.VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT, null); handleError("Login Error:", job.WaitWithoutResults(), lib); Console.WriteLine("Logged in..."); //let programToRun be something like C:\temp\autosetup.exe

Console.WriteLine("Running program: " + programToRun); job = VM.RunProgramInGuest(programToRun, null, 0, null, null); handleError("Run Program Error:", job.WaitWithoutResults(), lib);

On Windows Vista, i have the following behaviour:

When this code is run from visual studio, the setup is started and the automated install works.

When i put this into a ms build task and run it from a build script, the interactive services screen pops up and the automation does not work.

Do you have an idea what might cause the problem? Since the code is identical and both use VixCOM, i dont get whats going wrong.

I am using VM Workstation with the latest updates.

Thanks for your help!

0 Kudos
0 Replies