Thursday, July 4, 2019

VB Script to keep unlock your windows machine

This tutorial explains how to keep your windows machine unlock using vbscript .This is common problem that we encounter that we have automate our suite and run the same at any given time.


However we can schedule the scripts using windows scheduler or other alternative but problem arises when we need to run the scripts unattended. There are times we want to keep our windows machine unlock when not in use or system is left idle for some duration.

dont_lock.vbs
set wsc = CreateObject("WScript.Shell")
Do
WScript.Sleep (60*1000)
wsc.SendKeys ("{SCROLLLOCK 2}")
Loop

Step 1: Copy the above code into notepad file as it is.

Step 2: Save the file with any logical name you want but with .vbs extension to convert the notepad file into vb script executable file.

Step 3: Double click the the file it will start running.

Note: keep in mind what keys you are sending, this might effect if any automation scripts are running or any task on desktop running.

2 comments: