Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate Screen Lock 1

Status
Not open for further replies.

rbri

Programmer
Jun 27, 2002
84
0
0
US
Hello Everyone
I am tring to through a vbscript to screen lock a Windows 2000 machine. So instead of having to press ctrl+alt+del
and pick the Lock Computer button I want to have an icon on the desktop call a vbscript that will preform that task for me. I have looked for the file that controls the screensaver I am using but I can't seem to find it I am using the Marquee I have also tried to code the key strokes ctrl+alt+del I get error incorrect syntax. Can anyone point me in the right direction. Thanks in advance for any help I can get.

Thanks Randy
 
Set oShell=CreateObject("WScript.Shell")
oShell.Run "rundll32.exe user32.dll,LockWorkStation"

Rundll32.exe and user32.dll must be in the windows path and LockWorkStation must appear exactly as shown. This will only work with 2k & later.

You really don't need VBS, just create a windows shortcut with the target set to
rundll32.exe user32.dll,LockWorkStation

Jon Hawkins
 
Thanks

That worked very well it is just what I needed.

Thanks Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top