- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to remove connected remote desktop user sessions using PowerShell?
We can remove connected RDP sessions using PowerShell and for that, we can use the cmd command “reset session” in PowerShell. Let’s see the supported parameters for it.
Example
PS C:\> reset session /? Reset the session subsytem hardware and software to known initial values. RESET SESSION {sessionname | sessionid} [/SERVER:servername] [/V] sessionname Identifies the session with name sessionname. sessionid Identifies the session with ID sessionid. /SERVER:servername The server containing the session (default is current). /V Display additional information.
We can provide here session ID or Name and also the remote server name.
Suppose we have below active sessions on a remote computer called Test1-Win2k12,
We can disconnect the remote sessions using Session Name or the Session ID. First, we will disconnect the remote sessions with session ID 1.
reset session 1 /server:test1-win2k12
When we query the session again,
Example
query session /server:Test1-win2k12
Output
Now we will disconnect the session called rdp-tcp#0 using the SessionName,
reset session rdp-tcp#0 /server:test1-win2k12
Let’s query the session again and it should get disconnected from the remote server.
- Related Articles
- How to get connected remote desktop users on computers using PowerShell?
- How to Access Remote Desktop from Browser Using TightVNC
- How to restart a remote system using PowerShell?
- How to test remote computer connectivity using PowerShell?
- How to List All Connected SSH Sessions on Linux
- How to check if remote ports are open using PowerShell?
- How to get all the processes on remote computers using PowerShell?
- How to remove windows features using PowerShell?
- Best RDP (Remote Desktop) Clients for Linux
- How to remove windows folder sharing using PowerShell?
- How to change the local user account password using PowerShell?
- How to set the local user account settings using PowerShell?
- How to find the locked local user accounts using PowerShell?
- How to get the disabled local user accounts using PowerShell?
- How to remove the mapped network drive using PowerShell?

Advertisements