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 2,969 other subscribers

Archive for June 7th, 2012

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 allow 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: [WayBack] (404) Don’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 link is broken).

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


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

Posted in Development, Power User, Scripting, Software Development, Windows, Windows 7, Windows 8, Windows Vista, Windows XP | Leave a Comment »

%d bloggers like this: