Jump to content

Recommended Posts

Posted

I wanted to make some script which would run on computers with logged on users to prevent them lock screen, because usually I need to do some preparations or modifying in another script which I want to remotelly run there and it wouldn't work on a locked screen - or maybe I am wrong and some functions like winwaitactive work on locked comp - so I need something to delay it or prevent.

I tried a script which periodically moves a mouse 1 pixel left and then after one minute 1 pixel right, but it seems not to work - the computer locks.

So what can I do besides somehow changing the time to run the screensaver?

Posted

To disable locking the workstation for any user, go to:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\

System

For specific users, go to the same location, except use Current User instead of Local Machine.

Once there, make a DWORD value called 'DisableLockWorkstation', and set the value to 1 to disable locking of the workstation.

Source

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
  • 15 years later...
Posted

I have made a very simple and easy to use script(.bat) which disabled autolock by running the script in a console(cmd) window. If you want to stop the script, the user just need to close the console window.

:: SAVE this script as a .bat file and execute it to disable autolock   
@echo off
COLOR 0A
mode 69,9
title Stay Awake
echo Dim objResult > %temp%\stay_awake.vbs
echo Set objShell = WScript.CreateObject("WScript.Shell")    >> %temp%\stay_awake.vbs
echo Do While True >> %temp%\stay_awake.vbs
echo  objResult = objShell.sendkeys("{NUMLOCK}{NUMLOCK}") >> %temp%\stay_awake.vbs
echo  Wscript.Sleep (5000) >> %temp%\stay_awake.vbs
echo Loop >> %temp%\stay_awake.vbs
echo Start Time: %date% %time%
ECHO Please close this window to stop the Stay_Awake Script
echo.
cscript %temp%\stay_awake.vbs

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...