PowerShell, Server, Windows

Lock-Workstation

You can do everything with PowerShell, yes as well locking your workstation with one simple function call. The function uses the API by importing the user32.dll and is being invoked to lock the workstation. Thanks to Mike Pfeiffer from TechNet for this simple but useful script. The fine thing is, it works on a local or remote session.