Forum Discussion

chaarim's avatar
chaarim
Occasional Contributor
7 years ago

Unable to run test - User session locked

Hello,

 

I have a scheduled task that run a TestComplete project - containing GUI tests and file checkpoints.

I have the following error in the testcomplete log (when running putty to connect to Unix machine):

 

The operation cannot be performed , because the user session is locked

Possible reasons:
* The computer is locked.
* The UAC prompt is displayed asking for a user confirmation, and the user session is locked until a response is provided.

 

The test (and the scheduled task) is run on a distant machine (Virtual Machine), that we access to via a remote desktop.

The machine OS is Windows 2012 Server - R2

 

The option 'Run only when user is logged on' is checked in the task properties

'Run with highest privileges' is also checked.

'Start the task only if the computer is on AC power' is checked

'Wake the computer to run this task' is checked

 

Before running the task, I disconnected the user via tscon utility as mentioned in this page

 

https://support.smartbear.com/testcomplete/docs/testing-with/running/via-rdp/keeping-computer-unlocked.html

 

The screen saver is disabled.

 

In the power options, 'Turn off the display' is set to Never

'Put the computer to sleep' is set to Never

 

Could you please help me to solve this issue, so that the test could be planned via task scheduler ?

 

Thanks

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Your remote machine... is it a VM with an available console screen?  The reason being is that, if it's a regular PC you're logging into, the TSCON process MIGHT not work.  If you can, verify that after the TSCON is run, that there is, somewhere, a console of the PC running unlocked with a visible UI.

    • chaarim's avatar
      chaarim
      Occasional Contributor

      Hello,

       

      Yes, my remote machine is a virtual machine.

      So, is there any solution if tscon does not work ?

       

      Thanks

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        a) Are you sure that disconnected session is not locked after some timeout? (I am not 100% sure, but note, that while switching to console with tscon, if console session already exists (or created?), it is possible that it will be running under different user and thus your display settings may not match those for the console.);

        b) tscon requires administrative permissions and must be executed 'As Administrator'.

         

        Can you check that both conditions are met?

         

        As a last resort you may try a bit tricky workaround:

        -- Open remote session to same machine (boxA);

        -- Open remote session to your test machine (boxB) from boxA. I.e. you will get remote session running within another remote session;

        -- Launch tests on boxB;

        -- Disconnect boxA remote session. Session disconnection should leave remote session on boxB running.