Hyper-V and Windows AutoLogon
The ability for build and release agents to automatically login in order to complete UI-interacting integration tests is important. Windows developers, read on.
Join the DZone community and get the full member experience.
Join For Freewhen you configure build agents, and especially when you configure release agents for vsts, it is quite normal to have some installations where you want to use autologon. this is needed whenever you want to run integration tests that need to interact with the ui. having autologon enabled avoids the need to manually log in and start the agent when the machine is rebooted, because you always have a user session opened that runs the agent.
there are lots of articles like this one that explain how to configure everything, but last saturday i had a problem, because i had a windows server 2016 where that technique does not work. i rebooted the machine, but the hyper-v console showed me the login pane, and i was really puzzled.
figure 1: login screen in hyper-v console.
as you can see from figure 1, the hyper-v console shows the login page, so i incorrectly believed that the autologon did not work. i said "incorrectly" because, when trying to troubleshoot the problem, a friend told me to check the hyper-v manager console, and here is what i saw:
figure 2: small thumbnail of the vm in hyper-v snap-in.
from figure 2, you can see that the thumbnail of the vm does not show the login page, but it shows a user session logged into the machine. a quick check confirmed me that the agent was online, so the automatic logon worked, but my virtual machine console still shows me the login screen.
the reason is in the enhanced session feature, available in the view menu of the virtual machine console. the enhanced session is used to allow windows resizing, clipboard transfer, and so on and uses remote desktop under the hood. if you turn off enhanced session and use the basic hyper-v console, that shows you that a user is really connected to the system.
figure 3: the console in basic session mode correctly shows the logged user.
it turns out that, with enhanced mode, you are not able to see the session that is started automatically, but the session is active. if you really want to verify what is happening, you can simply switch to basic mode.
Published at DZone with permission of Ricci Gian Maria, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments