Set up Microsoft Autologon for team agents
Tosca Cloud lets you run tests on unattended virtual machines in the cloud. To enable this, set up your machine to automatically log in using Microsoft Autologon (opens in new tab). This allows your agent to have an interactive session.
Before you start
Disable interactive logon messages. On-screen messages prevent the Autologon process from accessing the machine.
Use a local or domain-based dedicated user, or a Windows Service Account, to set up and run the team agent. This prevents conflicts between users and avoids problems when login credentials expire.
Configure your agent
To configure your agent for unattended test runs with Microsoft Autologon, follow these steps:
-
Install Microsoft Autologon (opens in new tab) and configure credentials for an account that will be used to run the agent. Every time the system starts, it uses these credentials to log on and create a Windows console session on system boot.
-
Always use the argument --keepdisplayon while configuring Launcher to avoid machine lockouts. Without this argument, settings that lock a machine or put the machine into a sleep state after a configured timeout threshold may block any test runs sent to the team agents.
-
-
Get the client secret from your tenant to authenticate the team agent.
After the setup, the client secret value will be stored in the user profile and can be used later for Launcher and the team agent.
-
Create a batch script to run the team agent.
Batch script for Windows Server systems:
CopyREM launch-team-agent.bat
@echo off
REM Set display resolution (Windows Server only)
REM Adjust width and height to your requirements
PowerShell -Command "Set-DisplayResolution -Width 1920 -Height 1080 -Force"
REM Start the team agent
launcher agent --shared --keepdisplayon --liveview --tenant <YOUR-TENANT> --agentId <AGENT-NAME> --characteristics <name1>:<value1> <name2>:<valu -
Edit the resolution values in the script to set your desired height and width. Without this command, the Autologon console session will start in 1024x768 resolution with a 4:3 aspect ratio. The PowerShell Set-DisplayResolution command is only available on Windows Server systems. If you're using a different operating system, update the command to ensure compatibility.
-
Replace arguments in the launcher command to define your values for --tenant, --agentId, and --characteristics.
-
The argument --shared is required to start Launcher as a team agent.
-
We recommend using the argument --keepdisplayon to ensure that the console session doesn't lock or timeout. Please note that local GPO or security settings may override this argument, and you may need to adjust the environment.
-
Use the argument --liveview to allow your users to turn on LiveView and view the activity on the team agent in near-real time while running tests.
-
Optionally, define the --characteristics argument to change default characteristics.
-
Manually run this script to authenticate the agent and confirm that you have the proper permissions to run batch or PowerShell commands.
-
When you run the batch script for the first time, Launcher asks you for the client secret. You can get the client secret when you set up your agent.
-
We recommend saving this script in a location where other users can view and run it if needed. Avoid saving this script in a location where only the Windows Service account or administrator user can access it.
-
Make the batch script run automatically:
-
Add the batch scrip to your startup programs.
-
Create a shortcut in the Startup folder for Autologon user, located in C:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup.
When the machine boots and the user signs in, the script automatically starts the team agent.
-