Ok, guys, here is the scenario:
1)We have every night 3 scheduled scripts running, those are Python scripts that use autogui functions, so we must have an active session. We run an rdp, say, to machine X (which runs the codes) inside rdp to machine Y (this was a solution we found so that the autogui will get machine Y's gui and peripherals when the session is disconnected).
2) Our IT dept. is unsupportive and will not change the group policy that blocks the user session after 15 minutes.
3) We devised a simple script that sends keystrokes every 3 minutes (scroll lock specifically). We run this in both machines X and Y, on a powershell session kept open in both machines. The script is shown below.
$Shell = New-Object -ComObject Wscript.Shell
Start-Sleep -Seconds 1
Do {
$Shell.SendKeys("{SCROLLLOCK}")
$Shell.SendKeys("{SCROLLLOCK}")
Start-Sleep -Seconds 180
}
While($True)
THE PROBLEM: The script seem to work fine for most of the time, then some days it would not. It will work for 1 or 2 days in a row then fail the next one. By fail I mean I open the rdp session in the morning and my session is locked up, meaning all the nightly scripts failed and we'd have to spend half of the day running everything, all the company's reports, delayed.
This is becoming increasingly frustrating and we have a lot of pressure to make this work, to keep the session active overnight without IT involvement because they would not change their policy.
THE QUESTION: if the script below seem to work fine at least during the day, and sometimes for days in a row, what other actions/processes would cause my session to be disconnected? Another policy we must circumvent by other means? Another user's actions?