Over a million developers have joined DZone.

Hyper-V and Windows AutoLogon

DZone's Guide to

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.

· Integration Zone ·
Free Resource

WSO2 is the only open source vendor to be named a leader in The Forrester Wave™: API Management Solutions, Q4 2018 Report. Download the report now or try out our product for free.

When 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.

IAM is now more than a security project. It’s an enabler for an integration agile enterprise. If you’re currently evaluating an identity solution or exploring IAM, join this webinar.

hyper-v ,windows ,integration testing ,integration

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}