Thursday, August 21, 2008

Visual Basic Script to Lock Computer

Lock Machine (Computer) using VB Script

My good friend Venugopala Reddy Ragi had a good VBScript snippet to lock computer. Probably useful for someone to enhance security

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run "rundll32 user32.dll,LockWorkStation"

5 comments:

  1. Anonymous3:32 AM

    Yeah real cute. But how do you unlock the computer?

    ReplyDelete
  2. Mr. Tabraiz8:20 AM

    Then how to Unlock Computer when VB script working on it.....?

    Sincerely Waiting for your Reply..

    ReplyDelete
  3. I think you just restart the computer and the script shuts down therefor unlocking it?

    ReplyDelete
  4. All this script does is take you to the logout screen. It's no different that pressing winkey+l, or (assuming you're running XP) by clicking the logoff button in the Start Menu, and selecting "Switch User". All you do to get back into Windows is log on just like you would if the computer was starting up.

    Also, you can take the last bit, "rundll32 user32.dll,LockWorkStation" (without quotes), and type it into a command prompt or batch script and get the same result.

    Either way, this could come in quite handy if you want Windows to start up your profile automatically (perhaps so you can walk away while your startup apps are loading), but don't want people to mess with your computer. At lest that's what I will use it for :)

    ReplyDelete

StumbleUpon
Share on Facebook
Related Posts Plugin for WordPress, Blogger...
Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.