title: How can I remotely unlock a Windows workstation using SSH?
body: <p>I'm running an <strong>OpenSSH</strong> server on a <strong>Windows 10</strong> workstation, which I'm connecting to from <strong>Linux</strong> and using to run PowerShell scripts on the host machine, querying information about things like running processes and administrating the system.</p>
  <p>I know that some actions such as remotely <a href="https://superuser.com/questions/1297211/applications-executed-using-ssh-dont-show-on-remote-machine">launching a gui application visible to users on the host machine</a> are limited as a result of OpenSSH's <code>sshd</code> service existing in <a href="https://github.com/PowerShell/Win32-OpenSSH/issues/998" rel="noreferrer">session 0 isolation.</a>
  I've been able to work around this freely by scheduling anything I want to execute as a task with <code>schtasks.exe</code> and immediately running the task.</p>
  <ul>
  <li>I can lock the workstation with <code>rundll32.exe user32.dll,LockWorkStation</code></li>
  <li>I can query whether the workstation is locked with <code>Get-Process logonui</code></li>
  <li><strong>How would I unlock the system?</strong> <em>I need something that could be automated at the click of a button on the client machine.</em></li>
  </ul>
  <p>I've tried this <a href="http://www.softtreetech.com/24x7/archive/51.htm" rel="noreferrer">third-party utility called <code>Logon.exe</code></a>, to no avail. I don't believe it is compatible with Windows 10.</p>
  <p>I've even tried using <a href="https://superuser.com/questions/1249976/sendkeys-method-in-powershell#1250038"><code>SendKeys()</code></a> with PowerShell to send the password's keystrokes while on the lockscreen and then press enter, as well as an AutoHotKey script to do the same. While the keystrokes cause the lockscreen to wake up, neither methods seem to be capable of creating any input in the password input field.</p>