About the author

My name is Donovan Brown and I am a Principal DevOps Manager with Microsoft with a background in application development. I also run one of the Nation’s fastest growing online registration sites for motorsports events DLBRacing.com. When I am not writing software I race cars for fun. DLBRacing.com has given me the opportunity to combine my two passions writing software and racing cars.

I run Coded UI and Selenium UI test using my build agent. To do so the agent must be run in interactive mode. However, if you configure your agent to run interactive, it will not restart automatically after a reboot. If your system is configured to automatically install updates, your server may get rebooted without you knowing and prevent your agent from starting.

To solve this you can configure Windows to automatically log in a user and start the agent in interactive mode for you. To begin we need to enable automatic log in.

Press Windows Key + R to open the Run dialog

Type in the following and press enter:

control userpasswords2

Uncheck the box for User must enter a user name and password to use this computer.

Click the Apply button
You will be prompted by an Automatically sign in dialog

Enter the password for the user

Click OK

Click OK on the Users Accounts dialog

Now every time your machine is rebooted the configured user will automatically login to the machine.

Now we need to make sure that once the user is logged in that our agent starts in interactive mode. To do this we are going to create a shortcut that will start our agent then simply place that shortcut in the startup folder for Windows.

Right-click the desktop

Select New / Shortcut

Enter cmd

Click Next

Change the name to Start Agent

Click Finish

Right-click on the new shortcut

Select Properties

Append /c {pathToVsoagent.exe} to the target
If you installed your agent to C:\Agent, your target should look like this: C:\Windows\System32\cmd.exe /c c:\agent\agent\vsoagent.exe

Click OK

If you double click the shortcut, your agent will start in interactive mode. Now we need to copy this shortcut into the startup folder for Windows. This will ensure that each time we login the agent is started.

Press Windows Key + R to open the Run dialog

Type in the following

shell:startup

Click OK
This will open the Startup folder in Windows Explorer.

Drag and drop the shortcut to this folder

Now whenever your machine is restarted your agents will start up in interactive mode.

Thanks for writing this post! We have an issue at work however which prevents us from using this method. Our corporate group policy settings do not allow us to turn off the "user must login" checkbox. I had expected the 2015 Windows Service agent to run in interactive mode. Is that not possible?