Hi ThomasAlbertini-2349,
Using Powershell, you can get a list of remote desktop sessions using the commands QWinsta and Query.
List Remote Desktop Sessions using QWinsta:
QWinsta /server:[Server name or IP]
Replace the parameter [Server name or IP] with the name or IP address of the remote machine.
QWinsta /server:210.168.1.54
Get Remote Desktop Sessions using Query:
Query user /server:[Server name or IP]
Replace the parameter [Server name or IP] with the name or IP address of the remote computer.
Query user /server:210.168.1.54
You can use the below powershell command to get clear output.
(Query user /server:210.168.1.54) -replace 's{2,}', ',' | ConvertFrom-Csv
The following command exports the output to CSV file.
(Query user /server:210.168.1.54) -replace 's{2,}', ',' | ConvertFrom-Csv |
Export-CSV "C:\RDPSessions.csv" -NoTypeInformation -Encoding UTF8
---------------------------------------------------------------------------------------------------------------------------------------------------------
--If the reply is helpful, please Upvote and Accept as answer--