2

I want to lock my computer from ssh using psshutdown but it isn't working :/ I tried everything i found on internet but I ended with error

C:\Users\amade>psshutdown -l

PsShutdown v2.52 - Shutdown, logoff and power manage local and remote systems
Copyright (C) 1999-2006 Mark Russinovich
Sysinternals - www.sysinternals.com

Error locking local system:
Access is denied.
DavidPostill
  • 153,128
  • 77
  • 353
  • 394
Smogroove
  • 21
  • 1
  • Are you running the executable as an elevated user? Have you tried to specify the username and password of an Administrator? The error you received is indicating the user that your using does NOT have the required permission. – Ramhound Jan 05 '21 at 19:04
  • @Ramhound It doesn't work for me either (running as admin on Windows7). The command runs and claims the computer is locked but it isn't – DavidPostill Jan 05 '21 at 19:09
  • @Ramhound Yeah, I tried – Smogroove Jan 05 '21 at 19:48
  • @DavidPostill - the shutdown command doesn't do user authentication. So alternative [methods](https://social.technet.microsoft.com/Forums/en-US/8e32fbe2-1195-4d8e-925c-f012e5814315/psshutdown-access-is-denied?forum=pstools) have to be used. – Ramhound Jan 05 '21 at 19:50

1 Answers1

1
  • Locking PC: psexec -s -i 1 \\DESKTOP-TRISK "C:\Windows\System32\psshutdown.exe" -l -t 0. Change DESKTOP-TRISK to your desktop name -> open cmd and type in "hostname", should display your current desktop name.
  • Sleeping PC: psshutdown -d -t 0
  • Shutdown PC: psshutdown -f -t 0

Credits to u/Trisks for finding this solution