Forum Discussion

sriguda's avatar
sriguda
Frequent Contributor
8 years ago
Solved

How to run make scripts run successfully on a virtual machine that is locked?

Hi,

I am running couple of scripts virtual machine remotely connected from my desktop.

 

I have schedular set up on that virtual machine. I am disconnecting from the virtual machine by running the bat file with command,

 

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

 

So when I am working on desktop, the schedular on Virtual machine kicks in and scripts are run fine.

 

But when I lock my desktop also, the scripts fail running on disconnected Virtual Machine after a while like 20 mins.

Looks like they run fine immedietly or within 10 minutes of locking the desktop.

Is my VM getting logged off after a while? I don't understand where is the screen on VM at the time of running from that is attached on the screen shot .

 

It triggers schedular but gives error IE is invisible and and please lookat the screen shot attached on VM.

 

Please see the screen shot of log when both VM and Desktop locked.

 

  • sriguda's avatar
    sriguda
    8 years ago

    ok, I contacted our Admin and learnt to run Task schedular with Administartors group and now the scripts run fine.

     

    On Task Schedular under Security options, Change User or Group to Administrators.

     

    Thanks a lot.

13 Replies

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Considering that you are seeing it consistently as a 10 - 20 minute predictable time, something you might want to make sure of is that your virtual machine doesn't have any screen savers enabled or any group policy that will automatically lock out a workstation after a configured period of time.  This could especially happen if your test has long segments of the test that don't do any actual UI work but are doing things like SQL queries and such in the background.  A good best practice is to disable such screensavers or GPO's on your VM's used for automated testing.

      • sriguda's avatar
        sriguda
        Frequent Contributor

        I disabled screen saver. Disabled Power sleep and turnoff options. Disabled screen saver on lock screen as shown in the snap shots attached.

         

        The scripts still fail to run.

         

        How do i disable Windows logon screen? 

         

        ok I don't see the option User must enter username and password to use this computer on my Remote desktop as shown int he attachment.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Question: When you lock your desktop, are you still connected to your remote machine?  Because, if you are, the act of locking your local desktop will lock the remote one as well. 

     

    Try:

    1) Log in to remote machine

    2) run the batch file

    3) disconnect from remote machine

    4) lock your local machine

     

    This SHOULD leave the remote machine unlocked and running the tests.  If you forget step 3, you will lock your remote machine as well.

    • sriguda's avatar
      sriguda
      Frequent Contributor

      I am doing the same.

      1. I am running batch file on remote machine and disconnecting.

      2. I am letting the scripts run through task schedular without locking my desktop.

      3. The scripts run fine if they trigger within 10 to 15 minutes of me disconnecting from remote machine but after that they keep failing.

      4. Same this happens when i lock my desktop with remote machine disconnected.

      5. I tried to remove the screen saver but it still keeps failing with the screen shot of screen saver.

       

      Please see the screen shot of attached log. the explorer had the expected url, the script entered userId and Password and after that the screen saver appeared. Looks like it is locked after that. What I didn't understand is how did it lock the screen when activity on the screen is going on.

       

      Anyways the scripts fail when the remote machine is locked even after disconnecting from that.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        It comes down to this: Something is locking your VM.  Not being in your network or administering your network, I cannot say what.  It looks like some sort of automatic group policy or something.  You need to work with your network administrators to figure out why the machine is consistently getting locked.