Forum Discussion

nandini_thota's avatar
nandini_thota
Contributor
2 years ago

Desktop invisible error when system is locked while running regression

Hi Community,

 

I've my office laptop - Consider Machine1

I am connecting to Client VDI from Machine1 - Consider this is Machine2

From my Machine2, I am connecting to self hosted agent where build would actually run - Consider this is Machine3

Issue Scenario:

When I trigger regression pipeline from Machine2, I see scripts running in Machine3 and when I restore the Machine3, execution is going well.

But when Machine2 is locked, I am getting Desktop is invisible error and all the further scripts are failing giving the same issue - In this case, only Machine2 is getting locked, if I login to Machine2 and check Machine3.....screen is not locked and session is also active.

 

Can anyone please provide a solution.

I've referred the below links but not able to get on what machine should I change the settings and what settings need to be changed too.

https://community.smartbear.com/t5/TestComplete-Questions/Desktop-is-invisible/td-p/164893

https://support.smartbear.com/testcomplete/docs/testing-with/running/via-rdp/keeping-computer-unlocked.html?_ga=2.74614100.73235540.1684415455-1469504101.1659610353

 

Thoughts: Do I need to ask the admin people to disable the screen lock and turn off sleep mode on Machine2?

 

Regards,

Nandini.

 

  • Prepare your TestExecute machine as mentioned in Running Tests via Remote Desktop

     

    Create your batch file to run your TC project on the VM. Run it, and make sure it works. Then create a scheduled task to call the batch file on your VM. Run the scheduled task, and make sure it works.

     

    On the VM, call tscon. This will disconnect you from the VM, but your session will remain active. From another computer, connect to your VMs Task Scheduler, and run the the schedule task, make sure it works.

     

    If you connect to your VM, Task Manager will show two active sessions. Your current session and the pervious session.

     

    Try and understand how the above works, and you should then be able to configure your job.

     

    If you run the following, you'll see the output it generates. And, tscon is expecting either session id or name as a parameter

    for /f "skip=1 tokens=3" %s in ('query user %USERNAME%') do (echo %s)
    
    or
    
    query user %USERNAME%
  • rraghvani's avatar
    rraghvani
    Champion Level 3

    If you're automating a GUI, then the machine must not be locked in anyway. Using tscon, disconnects the user, but session still remains active.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    How are you running your scripts, TestComplete, TestExecute or SessionCreator?

    • nandini_thota's avatar
      nandini_thota
      Contributor

      I am using Test Execute to run them on Machine3(self hosted Agent)

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Prepare your TestExecute machine as mentioned in Running Tests via Remote Desktop

     

    Create your batch file to run your TC project on the VM. Run it, and make sure it works. Then create a scheduled task to call the batch file on your VM. Run the scheduled task, and make sure it works.

     

    On the VM, call tscon. This will disconnect you from the VM, but your session will remain active. From another computer, connect to your VMs Task Scheduler, and run the the schedule task, make sure it works.

     

    If you connect to your VM, Task Manager will show two active sessions. Your current session and the pervious session.

     

    Try and understand how the above works, and you should then be able to configure your job.

     

    If you run the following, you'll see the output it generates. And, tscon is expecting either session id or name as a parameter

    for /f "skip=1 tokens=3" %s in ('query user %USERNAME%') do (echo %s)
    
    or
    
    query user %USERNAME%
    • nandini_thota's avatar
      nandini_thota
      Contributor

      Hi Raghavani,

       

      thanks for taking time to help us out. This solved our issue.

      Things done:
      1. On Machine 2, created a bat file using the below code:

      for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (
        %windir%\System32\tscon.exe %%s /dest:console
      )

      USERNAME is the username of Machine3

       

      2. On our pipeline, added the .bat file into our repo and created the task scheduler,