Hi,
I'm having problem with the LoginInGuest() function when using the VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT option. Here's the code written in C#:
jobHandle = vmHandle.LoginInGuest(guestUser, guestPassword, Constants.VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT, null); vixError = jobHandle.WaitWithoutResults(); if (vixLib.ErrorIndicatesFailure(vixError)) { throw new VMRobotException("Error when logging on to guest OS. Error code: " + vixError); }
every time this is run, it returns error code 3034 VIX_E_INTERACTIVE_SESSION_NOT_PRESENT (The specified guest user must be logged in interactively to perform this operation.) Any one help please?
BTW, I'm using VIX 1.6.
Thanks!
That's what the interactive session is. It is the session that occurs when a user directly logs into the console of the virtual machine.
If you need a solution that does not require a user session, you should not use the VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT. Otherwise, you will need to configure the guest OS to automatically log in on start up, and not prompt for a password.
Anyone any ideas??
You need to make sure that the interactive session is fully initialized before calling this. Specifically, we use the VMwareUser process in the guest to determine this, since this process should launch shortly after the user logs in.
There isn't at present a great way to do this from a pure automation standpoint. For now, you can log in through VIX without the interactive environment flag, and then do ListProcesses to see if it has started, sleep and repeat if not.
Hi Matt,
Can you please elaborate on this:
"You need to make sure that the interactive session is fully initialized before calling this. Specifically, we use the VMwareUser process in the guest to determine this, since this process should launch shortly after the user logs in."
What specific actions should one do before calling LoginInGuest() with VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT flag? Wait for some particular process in the process list to start?
Thanks.
Yes, wait for a process called "VMwareUser.exe" to start. On Linux it will be "vmware-user".
Just to make it 100% clear:
1) Wait for a process called "VMwareUser.exe" to start using VixVM_ListProcessesInGuest()
2) Login into the target system with VixVM_LoginInGuest()
Right?
Thanks.
To be clear:
2) Log in to the system with VixVM_LogInGuest() using the option VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT.
Yes.
I'm still having problem with this:(
I've made the program wait for the VMWareUser.exe process to launch before logon with the interactive environment. But after trying a few times, I think the process only starts when a user logon to the guest manually.
Is there any other way to determine if the interactive session is fully initiated on the guest?
Thanks!
That's what the interactive session is. It is the session that occurs when a user directly logs into the console of the virtual machine.
If you need a solution that does not require a user session, you should not use the VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT. Otherwise, you will need to configure the guest OS to automatically log in on start up, and not prompt for a password.
I see. Thanks mattrich!
I had exactly this problem, and followed the suggestions in this forum to work around it. I configured my WinXP Pro SP2 VM to auto-login following instructions found on the Microsoft support site. I tried waiting for the "VMwareUser.exe" process to appear before I did the VixVM_LoginInGuest() call with the VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT option, but the VixVM_ListProcessesInGuest() call returned:
3018 - Guest operations are not allowed for the anonymous user on this virtual machine
It took me a while to figure this out but I finally got a solution:
Login using VixVM_LoginInGuest() without the VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT option
Wait for the "VMwareUser.exe" process to exist using VixVM_ListProcessesInGuest()
Log out using VixVM_LogoutFromGuest()
Login again using VixVM_LoginInGuest() with the VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT option
This sequence works and allows programs run in the VM guest OS to interact with the desktop interactive environment. I've successfully used this to launch automated tests that use AutoIt to drive an application's GUI on the VM guest OS.
This is not working in Windows 2008 server either. The logged in session is created in session id 0, and the autologin'd user is running on session 1.
Has anyone had any luck trying to runprograminquest when the OS is Windows 2008?
The same code works on my Windows 2003 servers.
Vix version = VMware-vix-1.6.2-127388.exe
VixCOM in C#
public void VM_LoginGuest(string UserName, string Password)
{
// Locals
string strModuleID = m_strClassName + ".VM_LoginGuest";
try
{
checkVMHandle(strModuleID);
int nOptions = 0; //Constants.VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT
nOptions = Constants.VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT;
// Try the loginGuest calla
IJob ojobHandle = m_ovmHandle.LoginInGuest(UserName, Password, nOptions, null);
// Checks the return code to ensure nothing went wrong
ResultHandler oResult = new ResultHandler(strModuleID, m_oVixLib, ojobHandle.WaitWithoutResults());
m_bGuestLoggedIn = true;
}
catch (Exception oEx)
{
if (oEx is KfxException) { throw oEx; }
// Package the exception
throw new KfxException(strModuleID, oEx);
}
}
I have some VIX code that logs in fine to Windows XP, 2003, and Linux. The exact same code fails to login to Windows 2008 (yes, VMWare Tools is installed). There probably is a bug in VIX.
Has anyone had success with VIX connecting to Windows 2008?
I am having similar problems with logging into a Vista machine. I know that if you don't use VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT option what will happen is that you will run under session 0 which does not show the UI.
A micorsoft article below describes the changes:
http://www.microsoft.com/whdc/system/vista/services.mspx
When will VIX get the needed fix to make this happen?
Thanks,
Vinay A.
To help others that could read this post, currently you can be sure that you're able to do anything after powering on / reverting snapshot / something like that using the method WaitForToolsInGuest.
I'm experiencing the same behavior specifically with a Vista 32-bit guest machine.
VMware VIX API 1.13.0.40273
vSphere 5.5.0, 1331820
VMware Tools 9.4.0, build-1280544 (Typical installation)
Logged into desktop as Administrator (Session 1)
VMwareUser.exe doesn't seem to be included in vmware tools any more.
vmtoolsd.exe is running
VIX_E_INTERACTIVE_SESSION_NOT_PRESENT
Message was edited by: icnocop2 -Added VIX API version