Jump to content

Recommended Posts

Posted

We have created an automation utility to run UI tests on a an application and generate reports.

 

This would take around 2 hours, so we kept it in nightly basis.

 

But, as it is interacting with UI, the machine if anyone connects RDP before then the machine is getting locked.

And the automation which is launched with task scheduler will fails as machine is locked.

I disabled already sleep mode so only way of getting locked is with RDP.

 

So, as a remedy, I thought to create one more task to restart he machine and autologin is enabled.

 

But, there are onther API services running on this machine which gets failed if I restart.

 

So, is there any option to unlock the machine using AutoIT process, so that I will run it through task scheduler.

 

Please suggest.

 

I search the forum with how to unlock the machine, but I am getting only code to check whether locked or not.

Posted

But by the time my script runs if already the machine is locked then no use in disabling it right.
THe machine got already locked.

Posted

Yeah, even I thought the same when the team mentioned it :)

ANy option can you suggest to unlock the machine programatically.

 

Posted

Yeah, in the customer environment, there is a long process to get a vm, it would take atleast 3 months to get a machine.

So, checking for workaround for this.

Posted

Thanks @BigDaddyO

But, if the user connects to desktop in the morning and by the time the automation runs in the evening, the RDP is already disconnected and the machine is in locked state.How to cover this scenario?Can you please suggest

Posted

If the user connects in the morning, and uses the script to log themselves off of RDP, the machine should not be locked in the evening.

it all hinges on the users using the RDP redirect script to disconnect.  If they close the RDP window themselves, or log off themselves, then it won't work.

 

It might also lock due to the system being left alone for a long time.  you might need to write up a small keep awake script to launch in the section in the code that shows.

;----------------------------------------------------------------------------------------------------------
;This is where your automation code would go, take screenshots, interact with Desktop, etc...
;----------------------------------------------------------------------------------------------------------

ShellExecute(@ScriptDir & "\awake.exe")

 the keep away script could be something as simple as this.

;Simple Keep awake script
$oNoSleep = DllCall('kernel32.dll', 'long', 'SetThreadExecutionState', 'long', 0x80000003)  ;0x80000003 to disable windows sleep mode

While 1
    Sleep(500)
WEnd

 

Posted

Hi.

 

I had just the opposite problem with a VM doing background jobs, that require, that there is a active console logon session, as interaction with program's GUIs is required (impossible to install that stuff as-a-service, the GUI is a must -- Autodesk Inventor Automation)

When connecting by RDP, the RDP session was terminated after randomly, quite short time, as I used Sysinternal's Tool Autologon https://docs.microsoft.com/en-us/sysinternals/downloads/autologon

 

 

 

My Procedure:

  1. Use autologon to automatically login to windows
  2. Use a CMD file in the users startup directory to lock the screen (shutdown -l)
  3. To *STOP* the VM's Windows OS from "kicking-my-RDP-to-force-local-console-logon" I had to set this registry key to "0"
    So I assume, that when you explicitely set this value to "1", everything should be fine for you

 

Windows Registry Editor Version 5.00

 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
 "ForceAutoLogon"="0"

 

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...