December 21, 2016

Override windows idle timeout!

As a Siebel Consultant you must have come across windows machines with extremely short idle timeout. I guess I am not the only one who hates to type in password again and again, situation becomes worst when machine logs off or gets powered off due to idle session timeout!!

Out of frustration, I started to hunt for a solution. Keep in mind I don't have privileges to change setting on the OS.

Solution 1: Create VB Script that simulates key press. VBScript is Microsoft's scripting language it is enabled by default on all windows systems(in fact it is supported by Siebel). Dumb windows can not differentiate between the actual key press and key press simulated by VBS thus session remains active as long as you want.
Set WshShell = WScript.CreateObject("WScript.Shell")

Do while true
Wscript.Sleep 5000
WshShell.SendKeys "{NUMLOCK}{NUMLOCK}"
Loop

Script just needs to be saved in text file with *.vbs extention. Once you double click it will stimulate NUMLOCK key press after every 5 seconds and will never let session to time out.

Solution 2: Solution 1 is awesome but it might not work for you if you are on Citrix based VPN. For such scenarios I created an Excel Macro which executes from local machine and actually moves the mouse pointer into the remote client and clicks.

Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4

Sub WaitFor(NumOfSeconds As Long)
Dim SngSec as Long
SngSec = Timer + NumOfSeconds
Do while timer < sngsec
DoEvents
Loop
End sub


Sub Button1_Click()
Do While True
WaitFor 5
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
WaitFor 1
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Loop
End Sub

There is no windows policy or network solution which can differentiate this mouse click with the actual one, thus it goes completely un-noticed and windows never sleep at last.

Use these scripts with caution, as machine will always remain unlocked and active while scripts are running.

njoy!!


This might help your non Siebel Friends as well, So please do share!!!

No comments :

Post a Comment