PowerShell

PowerShell: Logging Off

Stop-Computer and Restart-Computer can shutdown and restart a machine, but there are things they cannot do, for example logging off the current user.

Here’s a simple function wrapper that utilizes a standard console application and wraps it into a PowerShell function:

function Invoke-Logoff {
    shutdown.exe /L
}

Leave a Reply

Your email address will not be published. Required fields are marked *