Disconnecting from Remote Desktop while executing automated tests

Explains how to restore a remote desktop session to the local console of the remote computer while you are executing automated tests on the remote computer.

Problem

When using Remote Desktop to connect to a remote computer, terminating Remote Desktop locks out the remote computer, displaying the logon screen. In the locked mode, TestArchitect is unable to continue to interact with the AUT’s GUI, so any currently running automated tests might fail.

Solution

To avoid this problem, use the tscon command to disconnect from Remote Desktop. tscon returns the control to the original local session on the remote computer, overcoming the logon screen. All programs on the remote computer continue running normally, including your running automated tests.

To disconnect from Remote Desktop, run the following command on the remote computer (in the Remote Desktop window) as an administrator:

%windir%\System32\tscon.exe <SessionID> /dest:console

where <SessionID> is the ID of your current Remote Desktop session, for example, 0. You will see the Your remote desktop session has ended message, and the Remote Desktop client will be terminated. But all programs and automated tests on the remote computer will continue to run normally.

Important:
If this command does not work, because the ID of the remote desktop session to which you want to connect is not correct. Try changing the number 0 (tscon.exe 0 /dest:console) to the number 1, and if it still does not work, keep incrementing the session ID until your remote desktop is released.

You can also automate the above disconnection step using a batch file or using the execute command built-in action.


Copyright © 2024 LogiGear Corporation. All rights reserved. LogiGear is a registered trademark, and Action Based Testing and TestArchitect are trademarks of LogiGear Corporation. All other trademarks contained herein are the property of their respective owners.

LogiGear Corporation

1730 S. Amphlett Blvd. Suite 200, San Mateo, CA 94402

Tel: +1 (650) 572-1400