- 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 get connected remote desktop users on computers using PowerShell?
To get the user sessions on the remote computers using PowerShell, we need to use the cmd query command. First of all, we will get the user sessions on the local computer using the below command.
Example
query session
Output
Let’s see what are other supported parameters for the query session command.
Example
PS C:\> query session /? Display information about Remote Desktop Services sessions. QUERY SESSION [sessionname | username | sessionid] [/SERVER:servername] [/MODE] [/FLOW] [/CONNECT] [/COUNTER] [/VM] sessionname Identifies the session named sessionname. username Identifies the session with user username. sessionid Identifies the session with ID sessionid. /SERVER:servername The server to be queried (default is current). /MODE Display current line settings. /FLOW Display current flow control settings. /CONNECT Display current connect settings. /COUNTER Display current Remote Desktop Services counters information. /VM Display information about sessions within virtual machines.
To get the sessions on the remote computers, we can use /Server:ServerName switch.
Example
query session /server:Test1-win2k12
Output
- Related Articles
- How to remove connected remote desktop user sessions using PowerShell?
- How to get all the processes on remote computers using PowerShell?
- How to get services on remote computers with 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 get the load balancers connected to the Azure VM using PowerShell?
- How to add users and groups to the local groups on Windows System using PowerShell?
- How to delete all users from specific OU using PowerShell?
- How to check if remote ports are open using PowerShell?
- How to create bulk users in the active directory using PowerShell?
- 5 Lightweight Linux Desktop Environments For Older Computers
- Best RDP (Remote Desktop) Clients for Linux
- How to get all the user profiles on the System using PowerShell?
- How to Get Windows features using PowerShell?

Advertisements