VMware {code} Community
nudicles
Contributor
Contributor

LogInGuest and RunProgramInGuest

The documentation specifies that I need to login in order to run programs using RunProgramInGuest. What's a little bit unclear to me, is if it is possible to log in the guest machine without logging in as the VIX_CONSOLE_USER_NAME. I've tried it, and VIX nags at me during runtime when I try to run the program inside the guest. Has anyone gotten this to work?

I can save a VM snapshot in a suspended state and login using VIX_CONSOLE_USER_NAME in order to run my program at the command line. The problem is, saving the snapshot at the suspended state takes up a lot more diskspace than saving it at poweroff. We will be sending these VMs over our network so the less bandwidth hog these VMs are, the better.

So essentially what I would like to do is have my script start from a snapshot where the VM is powered off, boot up the machine, log in and be able to run programs within the VM. It seems like I'm missing something, because that seems like it should be possible. Any tips?

0 Kudos
6 Replies
accessory
Contributor
Contributor

Hi:

I guess you cannot "login" a VM when it is powered off. You need to first power on it, either use VIX API or vmrun command line. Then you can try to login and run programs in the VM.

Hope this is helpful!

0 Kudos
admin
Immortal
Immortal

What kind of program are you trying to run: command line or GUI? Also, if it's GUI then do you need to have anyone interact with it?

Also, does the program need to have access to a specific user's environment?

If the program does not require any user interaction, then it should not be a problem. Just log in as the user and then call VixVM_RunProgramInGuest() with either 0 or VIX_RUNPROGRAM_RETURN_IMMEDIATELY as the options parameter (given whether you want to wait until the program finishes or not).

0 Kudos
nudicles
Contributor
Contributor

Edit: Yikes, nevermind. Looks like I was mixing up the Copy part of my code with the RunProgram part of it. Changing the options to 0 worked. Smiley Happy

Follow up question: What I'm essentially doing is running an automated install via GUI manipulation (AutoIt). So I guess what I am running is a GUI application, however, it does not require user interaction. The AutoIt script does, however, require interaction with the GUI. Would this be a problem?

Message was edited by:

nudicles

0 Kudos
admin
Immortal
Immortal

Ah, OK, I'm glad you've got it working.

As for whether this will work with a GUI manipulation tool... that's a good question. I'm not sure what kind of desktop environment will exist if no user has logged in. What kind of guest OS(es) are you running this with?

0 Kudos
nudicles
Contributor
Contributor

I'm running windows 2003, and using AutoIt v3 to automate.

I ran a test, it looks like it gets stuck when it tries to first interact with the GUI, i.e. clicking a button. Any ideas on how to get this working, if at all possible?

0 Kudos
nudicles
Contributor
Contributor

Well, I found a workaround. For those of you who are curious, I ended up changing the registry a bit so that my W2k3 machine logged in automatically. That way you can login using vix as the CONSOLE user and continue happily with your automation. Smiley Happy

0 Kudos