Contents

Function Lock-Workstation locally and remotely

Contents

You can do everything with PowerShell, as well as locking your workstation with one simple function call.

Just call the LockWorkstation() function in user32.dll and that’s it! The fine thing is, it works on a local and a remote session.

1
2
3
Function Lock-WorkStation {
    rundll32.exe user32.dll, LockWorkStation
}