The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,425 other followers

Programmatic alternatives to Windows-L keyboard shortcut (SwitchUser / LockWorkstation)

Posted by jpluimers on 2012/06/07

On Windows, the keyboard shortcut [WayBackWindows-L will lock your workstation and when [WayBackFast User Switching is enabled – and when your (corporate) policies allows it – shows your Switch User screen.

First of all, there is [WayBackTSDISCON (which I found thanks to [WayBackthis thread). It is meant to disconnect a terminal services session, but when you are logged in on the console, it just locks your workstation.

It is small (about 20 kilobyte) and [WayBackhas been there since Windows 2000.

Then there is the [WayBackLockWorkStation function that does the same.

Lot’s of people think you can call LockWorkStation using rundll32.exe. As per Raymond Chen: [WayBackDon’t do that: it has a different parameter count and different calling convention than [Archive.isrundll32.exe expects (note that in Raymond’s article, the last ling is broken).

So now you all go upvote [WayBack] the TSDISCON answer and downvote the ruldll32.exe LockWorkStation answers on this [WayBackSuperUser.com question.

–jeroen

PS: [WayBackRob van der Woude published a list of Terminal Server commands including TSDISCON.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: