When using Remote Desktop to connect to a remote computer, closing Remote Desktop locks out the computer, displaying the login screen. In the locked mode, the computer does not have GUI, so any currently running or scheduled Foxtrot runs will fail.
To avoid problems with Foxtrot, use the tscon utility to disconnect from Remote Desktop. tscon returns the control to the original local session on the remote computer, bypassing the login screen. All programs on the remote computer continue running normally, including Foxtrot.
But, please be aware that the resolution might change! Therefore, make sure that you resize all your windows to appropriate sizes (a size such as 1000x500) to make sure that the windows are always the same size and fit the resolution at all times.
You can make a batch file to run that will properly disconnect you from the remote computer. Create a batch file with this code (simply copy-paste this). You must run this as administrator, therefore, make sure to right-click on the file and run as administrator when disconnecting:
for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (
%windir%\System32\tscon.exe %%s /dest:console
)
To mark the batch file to always run as an administrator, do the following:
1. On the Start menu, locate the file that you want to always run as an administrator.
2. Right-click on the file and make a file shortcut, and then right-click on the shortcuts and select Properties.
3. In the Properties dialog box, click the Compatibility tab.
4. Do one of the following:
- To apply the setting to the currently logged-on user, select the Run This Program As An Administrator check box, and then click OK.
- To apply the setting to all users on the computer and regardless of which shortcut is used to start the application, click Change Setting For All Users to display the Properties dialog box for the application’s .exe file, select the Run This Program As An Administrator check box, and then click OK twice.
Now, when you need to disconnect from Remote Desktop, double-click this shortcut on the remote computer (in the Remote Desktop window). The file will now always run using an administrator access token. Keep in mind that if you are using a standard account and prompting is disabled, the application will fail to run.
NOTE that you cannot mark system applications or processes to always run with administrator privileges. Only non-system applications and processes can be marked to always run at this level. And if the Run This Program As An Administrator option is not available, it means the application is blocked from always running at an elevated level, the application does not require administrator credentials to run, or you are not logged on as an administrator.
You can also call this batch file at the beginning of your tests (provided that Foxtrot is run as an Administrator).
Comments
2 comments
This is great thank you! I have been fighting with this for a while running Foxtrot on a VM.
You can actually fix the resolution with a custom powershell function at the same time.
I just did some testing and using a Windows Task Scheduler job set to "Run with highest privileges" and this script is doing both. Checked using a console VNC connection waiting to be allowed to take over from RDP when tscon does its thing.
James Brammer great input!
What we are actually recommending to most clients is to use a managing server to manage and keep alive all their "bot" servers following the concepts presented on page two here: https://support.foxtrotalliance.com/hc/en-us/article_attachments/360030253811/Machine_Setup_Instructions.pdf
Shortly explained, the idea is that you remote from your:
Then, you can simply disconnect from PC --> Managing Server without interfering with the Managing Server --> Bot Server connection, meaning that the GUI will remain alive. Using the Remote Desktop Connection manager on the Managing Server also makes it easier and better to have an overview of multiple bots at once.
Please sign in to leave a comment.