1

So here's the story; At work I have two computers. Both Windows 7 and on the same network.

I've used the shortcut trick to create shortcuts on both computers that lock them when I leave.

rundll32.exe User32.dll,LockWorkStation

I was wondering though if there was a way to modify the shortcut or create a .bat file on my "main" workstation that would allow me to lock both stations.

I've googled a few times for a solution, but most results just lead back to instructions on creating the 'standard' shortcut I mentioned above, or a similar question asked on Stackoverflow, where installing 3rd party software is suggested.

4
  • Are these computer linked together in some capacity ( i.e. connected tot he same domain )?
    – Ramhound
    Jan 20, 2016 at 19:51
  • If both workstations are part of domain and your user has all required permission than it appears that this can be achieved using little VB script. This old post on MSFT Scripting guy has instructions for just about that. blogs.technet.com/b/heyscriptingguy/archive/2004/11/15/… (Word of caution: I have not tried it personally)
    – JackLock
    Jan 20, 2016 at 20:32
  • Ramhound, Yes, both computers are part of the same network and domain.
    – Dex Luther
    Jan 21, 2016 at 22:59
  • Danger! rundll32 is not an officially supported way to invoke Windows API functions. For this application, use tsdiscon.
    – Ben N
    Jan 22, 2016 at 0:25

1 Answer 1

0

It could be a tough task without installing additional additional software: you have to have something listening to your commands on another computer.

Unfortunately shutdown command does not support locking the workstation.

If you have PowerShell on both computers, you can try to use its remote features. To Run a Script:

invoke-command -computername Server01 -filepath C:\Scripts\LockWorkstation.bat

As another option, you can try to use PsExec utility from PsTools:

psexec \\Server01 cmd /c C:\Scripts\LockWorkstation.bat

I have tested neither approaches myself, just give you some ideas.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .