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"

6 comments:

  1. its damn pretty!!

    ReplyDelete
  2. Anonymous3:32 AM

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

    ReplyDelete
  3. Mr. Tabraiz8:20 AM

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

    Sincerely Waiting for your Reply..

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

    ReplyDelete
  5. 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
  6. hi..Im student from Informatics engineering, this article is very informative, thanks for sharing :)

    ReplyDelete

StumbleUpon
Share on Facebook
Related Posts Plugin for WordPress, Blogger...

Visual Basic for Applications (VBA) Forum (recent threads)

CodeKeep VBA Feed

Visual Studio Tools for Office Forum (recent threads)

Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.

Office Business Applications (OBA) Team Blog

MSDN Code Gallery Published Resources For Tag VSTO

microsoft.public.vsnet.vstools.office Google Group