Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

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

The State of API Integration 2018: Get Cloud Elements’ report for the most comprehensive breakdown of the API integration industry’s past, present, and future.

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.

image

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:

image

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.

image

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.

Your API is not enough. Learn why (and how) leading SaaS providers are turning their products into platforms with API integration in the ebook, Build Platforms, Not Products from Cloud Elements.

Topics:
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 }}