Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to List Remote Desktop Services Sessions on Windows

Remote Desktop Services (RDS) are a crucial part of managing and accessing Windows servers and workstations remotely. As a Systems Engineer, you may often need to list active Remote Desktop sessions to monitor user activity, troubleshoot issues, or manage resources. This article will guide you through various methods to list Remote Desktop Services sessions on a Windows environment using Command Prompt (CMD) and PowerShell.

Listing RDS Sessions via Command Prompt (CMD)

Using query Command

The query command is a built-in Windows utility that allows you to display information about user sessions on a Remote Desktop Session Host (RD Session Host) server.

Example:

  1. Open Command Prompt as an Administrator.
  2. Execute the following command to list all active sessions:

    query user

    This command will display a list of all users currently logged into the system, along with session IDs, session states, and other details.

Using qwinsta Command

The qwinsta command is another utility that provides detailed information about Remote Desktop sessions.

Example:

  1. Open Command Prompt as an Administrator.
  2. Execute the following command to list all sessions:

    qwinsta

    This will display a list of sessions, including session names, IDs, states, and the name of the user associated with each session.

Listing RDS Sessions via PowerShell

PowerShell provides more flexibility and scripting capabilities for managing Remote Desktop Services sessions.

Using Get-RDUserSession Cmdlet

If you are using Windows Server with the Remote Desktop Services role installed, you can use the Get-RDUserSession cmdlet to list active sessions.

Example:

  1. Open PowerShell as an Administrator.
  2. Execute the following command to list all active sessions:

    Get-RDUserSession

    This cmdlet will return a list of active user sessions on the RD Session Host server, including user names, session states, and other relevant details.

Using Get-Process Cmdlet

For environments where the Remote Desktop Services role is not installed, you can use the Get-Process cmdlet to filter processes associated with Remote Desktop sessions.

Example:

  1. Open PowerShell as an Administrator.
  2. Execute the following command to list all active sessions:

    Get-Process -IncludeUserName | Where-Object { $_.Name -eq "explorer" }

    This command filters processes to show only those associated with the explorer.exe process, which is typically started for each user session.

Conclusion

Listing Remote Desktop Services sessions on a Windows environment can be achieved through various methods using Command Prompt and PowerShell. These tools provide essential information for managing and troubleshooting remote sessions effectively.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.