Forum Discussion

NisHera's avatar
Valued Contributor
4 years ago

remote desktop not identify user

In a AWS instant need to run test on remote desk top

I used scripts mention 


My script start as ...


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



But I get message ....


C:\TestCompleteFiles\AutoRuns>for /F "skip=1 tokens=3" %s in ('query user MY_UserName') do (C:\Windows\System32\tscon.exe %s /dest:console )
No User exists for MY_UserName



when I go to Task manager Users tab .."MY_UserName" is shown

What could be the problem? 


I'm running as Admin..

  • sonya_m's avatar
    4 years ago

    Hi NisHera , I found your support case and see that you got a solution from our team.

    Let me quote it here:



    Unfortunately, this is not something I can help you with as this is an issue with Windows, not with TestComplete. I believe your local IT team should be able to help you out with this.
    However, quite often you don't even need tscon. This method redirects your session to console which has quite a small resolution. Depending on what you are testing, there is a high chance that your app will simply not fit into the console resolution, and your tests will fail. I suggest using SessionCreator to run unattended tests. It is capable of creating sessions for any users in the system. Note that this tool has a set of requirements that you have to meet before you can use it properly. The requirements are the same as for our Jenkins integration. So please go through this article and adjust the necessary settings (ignore Jenkins-related points).


9 Replies

  • Marsha_R's avatar
    Champion Level 3

    Can you go to that instance manually and run the test with that user name?

    • NisHera's avatar
      Valued Contributor

      Marsha_R  yes no problem with running test manually 

      and except that error the script also working fine.



      • Marsha_R's avatar
        Champion Level 3

        Does the script work for any other user name?

  • AlexKaras's avatar
    Champion Level 3



    AFAIK, this command requires elevated permissions and I am not sure that membership in the local admins group provides them.

    Can you start the script using the Run As Administrator context menu option? (I understand it that this command is executed out of TestComplete test code.) Does it execute with or without the error?


    • NisHera's avatar
      Valued Contributor

      AlexKaras  yes always I run commands as Administrator.

      TanyaYatskovska  no unfortunately I'm still struggling . I had a AWS instance previously running same OK. This was a new AWS Instance and I'm having admin roll in the machine. our tech guy says, I dont have a role/user in the AWS console yet. Dose that matters?


      more information............

      when I run 



      query user



        gets Sessionname as rdp-tcp#1

      and then I ran 



      %windir%\System32\tscon.exe RDP-Tcp#1 /dest:console



      works fine ...I was successfully disconnected without session being stopped.


      when Quering user I see...




      but error message says




      is it something to do with case sensitivity ?

      if so how could I correct it