Код:
qwinsta /server:$server | foreach {$_.trim() -replace "\s+",","} | ConvertFrom-Csv | Select *,@{n="Server";e={$server}}
Или можно установить модуль PSTerminalServices -
https://psterminalservices.codeplex.com/
Код:
PS > Get-TSSession
Server SessionID State IPAddress ClientName WindowStationName UserName
------ --------- ----- --------- ---------- ----------------- --------
localhost 0 Disconnected Services
localhost 1 Active Console Contoso\User
localhost 65536 Listening RDP-Tcp