View RDP Sessions for a Server and Logoff Remotely

Scenario: You want to view who is RDP’ed into a specific Server and then log off remotely specific sessions:

Scriptlet:

To View:
Invoke-Command -ComputerName “ExSrv1” -ScriptBlock { quser }

To LogOff:
Invoke-Command -ComputerName ‘ExSrv2’ -ScriptBlock { logoff 2 }


Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: