There are situations when you need to force end a remote user session on a server using Windows PowerShell. This can come in handy if the user’s session is frozen or if there is a need to do it as quickly as possible with a few commands.
In the “Taskbar”, right-click on “Windows PowerShell” and select “Run as Administrator”.
Check all active remote user sessions on the ru-msk-dc-01 server using the command:
Now end the remote user session “Administrator”. To do this, the next command will need to specify the ID of the remote session.
logoff 3 /server:ru-msk-dc-01 /v
Note that “/v” is used to display the detailed result of the command.
Remote user session “Administrator” successfully completed on server ru-msk-dc-01.
Let’s look again at all active remote user sessions on the ru-msk-dc-01 server using the command:
The remote user session “Administrator” is no longer in the list of remote sessions on the server ru-msk-dc-01.