

This error typically occurs when the user logging in is part of a different domain than the user that is used to run PowerShell Server. The following error indicates that one or more of those permissions have not been granted:Ĭlient failed authentication: LogonUser() returned error 0×00000569 (Logon failure: the user has not been granted the requested logon type at this computer) If ($_.Exception.Certain PowerShell Server settings will require special permissions on the system to allow the user log on with the requested logon type. # Loop through each session ID and pass each to the logoff command Write-Host "Found user login(s) on computer." PS> Invoke-Command -ComputerName 'REMOTECOMPUTER' -ScriptBlock Instead, we can run quser by itself on the remote computer. The quser command also can query remote computers using the /server switch, however, I have chosen not to use this method because we now have the advantage of using PowerShell Remoting. However, we’ll be using PowerShell to parse this string output so you don’t have to worry about it in the first place! >administrator console 1 Active none 11:04 AM USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME You can play around with this command by running it locally on your Windows computer to get an idea of the output. This is a non-PowerShell command but we can still just as easily use it from within PowerShell. There are a few ways to do that but I’ve chosen to use the quser command. We can even log off all users if we so desire.īefore we get too crazy though, we first need to figure out how to find which users are logged into a remote computer. Using PowerShell, we can create a script that reaches out to one or more remote Windows computers, checks to see if anyone is logged in and, if so, logs them out. It seems like every time you’d like to do some maintenance on the computer that requires a user logging out, they don’t seem to do it or the computer is idling with them logged in! Luckily, we can take this into our own hands by forcing a logoff remote from another computer. This is especially useful when you are trying to do maintenance.Įnd users are sometimes logged into their computers for far too long. Here is a quick and easy way to remotely log off end users who are still logged into their computers.
