Page 1 of 1

Lock Workstation

Posted: Sat Jun 27, 2009 4:08 pm
by alemrantareq
Hi everybody,

I need a solution. In windows xp, we can simply lock our workstation by pressing windows logo key + L. Now I want to make an application which will automatically do that after a pre-determined time and the user has no need to press those keys. How to do that?

Pls, help me as soon possible. Thanks in advance...

Posted: Sat Jun 27, 2009 6:09 pm
by RRobert
Try this:

Code: Select all

set the hideConsoleWindows to true
put shell ("RunDLL32.EXE user32.dll,LockWorkStation")
You could also lock the workstation using VBScript and the command do instead of the function shell.

Code: Select all

On Error Resume Next

Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%windir%\System32\rundll32.exe user32.dll,LockWorkStation"
See also: Hey, Scripting Guy! Can I Lock a Workstation Using a Script?

Posted: Sun Jun 28, 2009 3:35 am
by alemrantareq
Thanks a lot RRobert :D