When running automated tests on virtual machines using RDP sessions, the screen may become cluttered and one may wish to close these windows which attract our attention away from the current work. So, to disconnect from Remote Desktop, copy and paste the following code to a batch file on the remote computer (in the Remote Desktop window) and execute it as an Administrator right after launching the automated run session:
for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (
%windir%System32tscon.exe %%s /dest:console
About Meir Bar-Tal
Meir Bar-Tal is an Automation Architect with extensive technical, educational and leadership experience in Software Design, Development and Testing. For many years Meir has helped companies establish solid foundations for their testing activities with a wide variety of software applications and systems and across different technologies and platforms. Meir is a well-known expert in Data-Driven, Keyword Driven and Hybrid methodologies and has published a number of influential articles on the applications of Design Patterns to Test Automation. For the last five years, he has been pushing forward an ambitious program towards the development of an Object Oriented automation framework named Sunscrit, a huge project which is still underway. Meir is the owner of www.AdvancedQTP.com of which he was a co-founder in 2007 and served as its Editor in Chief, Author and Forums Administrator ever since. Meir lives in Israel and cooperates closely with HP R&D and other colleagues to improve the user experience and productivity with HP Software tools.