How To Prevent Security Policy Enforced Screen Lock in Windows – POFTUT

How To Prevent Security Policy Enforced Screen Lock in Windows

We are all believe security. But sometimes security become a bottleneck for our productivity. Enterprises generally put automatic screen lock after idle time for windows operating systems by using security policy.

I think this is very good enforcement because I see a lot of workers do not mind this type of security measures. But when using windows in VM it become a bottleneck entering password for a lot of times. Here is a script based solution. Save this script as idle.vbs and then double click it or more convenient start it with task manager for start at startup automatically.

idle.vbs Script

Following script is developed in Visual Basic scripting language which can be run most of the Windows operating systems like Windows XP, Windows 7, Windows 8, Windows 10, Windows Server 2008, Windows Server 2012, Windows Server 2016 . We will use CreateObject function which will used to send some trivial key strokes to the operating system. This will prevent system to lock the screen. The sending key interval will be set as 6000 milisecond which is fair. We will use Sleep function in order to prevent the script run for ever in a brute force mode.

Dim objResult

Set objShell = WScript.CreateObject("WScript.Shell") 
i = 0

Do While i = 0
 objResult = objShell.sendkeys("{NUMLOCK}{NUMLOCK}")
 Wscript.Sleep (6000)

6000 means 6 seconds the script sends NUMLOCK to prevent screen lock. We can change it according our policy interval.

LEARN MORE  Visual Studio Express Installation

Leave a Comment