Wednesday, October 7, 2015

Stop screensaver autolock

A quick VBScript could be useful in keeping computer active without screensaver automatically taking over. For security policies, most companies have automatic screensaver or session lock in place based on user inactivity. For those of us who need to keep the system monitor PC on all the time, this script could be useful. It basically sends escape key stroke once a minute for the duration of time you specify.

Dim shell, minutes, minuteCount
minutes = 300

Set shell = CreateObject("WScript.Shell")
minuteCount = 0
For minuteCount = 0 To minutes
  shell.SendKeys "{ESC}"
  minuteCount = minuteCount + 1
  WScript.Sleep(60000) 
Next

Just don't forget to lock the computer when you step away from the computer.
To stop the script, close "WScript.exe" in Task Manager or logout from Windows.

No comments: