ur Posted June 23, 2020 Posted June 23, 2020 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.
Danp2 Posted June 23, 2020 Posted June 23, 2020 Maybe you could disable RDP when your script starts and then enable it before exiting your script Latest Webdriver UDF Release Webdriver Wiki FAQs
ur Posted June 23, 2020 Author Posted June 23, 2020 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.
Danp2 Posted June 23, 2020 Posted June 23, 2020 OIC. When I initially read your post, I thought the issue was that someone RDP'd in while the script was running. Latest Webdriver UDF Release Webdriver Wiki FAQs
ur Posted June 23, 2020 Author Posted June 23, 2020 Yeah, even I thought the same when the team mentioned it ANy option can you suggest to unlock the machine programatically.
Danp2 Posted June 23, 2020 Posted June 23, 2020 Sorry, but I don't have a solution for unlocking the workstation. Perhaps you could approach this from a different direction. Why are you running this script on the same PC that others are accessing via RDP? Can you spin up a VM that is dedicated to this process? Latest Webdriver UDF Release Webdriver Wiki FAQs
ur Posted June 23, 2020 Author Posted June 23, 2020 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.
BigDaddyO Posted June 23, 2020 Posted June 23, 2020 You could try this, but you would have to inform the users to launch the script to close their RDP session instead of closing RDP themselves.
ur Posted June 25, 2020 Author Posted June 25, 2020 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
BigDaddyO Posted June 25, 2020 Posted June 25, 2020 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
rudi Posted June 25, 2020 Posted June 25, 2020 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: Use autologon to automatically login to windows Use a CMD file in the users startup directory to lock the screen (shutdown -l) 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!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now