How to Lock a Workstation with Screensaver for Security
Keywords: Ctrl-Alt-Del screensavername.scr
Question:
I am trying to write a WinBatch program that forces a user to authenticate themselves before performing an action. I have tried to send Ctrl-Alt-Del to bring up the NT Security screen but that is ignored, the IntControl options can only log a user out.If you can't do it with WinBatch, do you know a method outside of Winbatch to call up this screen other than Ctrl-Alt-Del so we can then use Winbatch to send the required keystroke?
Here is the scenario:
The user of an NT client is able to look at "confidential" information via an application. We want to be sure that it is the user that originally logged on who is running the application and hence we wish to force them into the "Lock Workstation" state so that they have to reauthenticate themselves.
Answer:
- The following works under Windows 2000 and XP. There is no comparable DllCall for NT4. See Microsoft Tech Article ID: Q262646:
run("rundll32.exe", "user32.dll,LockWorkStation")
- Or, a quick and dirty (but effective) way to do this is by invoking the secure screen saver. I've yet to see anybody defeat it. It will prompt for the user name and password.
To launch the screen blanker:
a=IniReadPvt("Boot","SCRNSAVE.EXE","FLYING~1.SCR","SYSTEM.INI") ERRORMODE(@OFF) ; WARNING DO NOT USE WITHOUT SUPERVISION LastError() run(a,"/s") ErrorMode(@CANCEL) if LastError() then Display(5,"Sorry","No screen blanker found")Note: when testing stuff, (ie: you change an NT screen saver to secure), you'll have to restart Windows as that's the Microsoft-way of initializing it.
Then, you should be able to invoke it with the run("screensavername.scr", "/s") WIL command.
Article ID: W13817Filename: Lock Workstation for Security with ScreenSaver.txt