Forum Discussion

Taz's avatar
Taz
Contributor
2 years ago
Solved

How to automatically end remote session without stopping UI Testing

I read the article "Disconnecting From Remote Desktop While Running Automated Tests" on this site.  Unfortunately this article didn´t address the issue of how to automatically close a remote session without affecting the Automated Tests.  We do have a signout.bat script that calls tscon.exe, but this requires someone has to run it with administrative rights.  That works fine, but the problem we´re having is that often someone forgets to log out and then the test fail if he shuts down his computer or logs out without using the signout.bat file.  We therefore want to automatically close the session after a period of inactivity.  How can this be achieved? 

  • Taz's avatar
    Taz
    2 years ago

    I'm not quite sure if this answers the question.  Our tests are running automatically triggered via the azure cloud.  We don't start them ourselves.  Howerver we often need to remote into there to pick up the reports, etc.  Normally we would click on a signout batch file that closes the session correctly.  However, it unfortunately also happens that at the end of the day someone forgets to close the session and then the nightly tests all fail because the session has never been closed correctly.  Therefore we want to ensure, that after five minutes of inactivity the session is automatically closed.  Normally this an be done using a group policy where a time period can be specified and then the session is either disconnected or closed completely.  However, none of these work for us buecause they cause the tests to fail or close the cmd window that waits for instructions.  What we need is something similiar but does use the signout.bat file instead after five minutes of inactivity. 

     

2 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Do you use SessionCreator?

     

    I have a remote desktop machine (which has Test Execute) where the user is constantly logged in, and I then use tscon to disconnect from the remote desktop.

     

    From another machine, I use Computer Management to connect to another machine i.e. the remote desktop machine. I run Task Schedular to kick off the automation on the remote desktop machine – the PowerShell script, gets the latest files from TFS repository, calls SessionCreater to run the automated scripts, results are written to a sharable folder. Once completed, the session is then closed.

     

    I can log onto the remote desktop machine without interfering with the other session that’s running the automation.