Great, check out the function Get-SBRDPSession in the SBTools module at http://gallery.technet.microsoft.com/scriptcenter/SBTools-module-adds-38992422
.Synopsis Function to get RDP sessions on one or more computers .Description Function to get RDP sessions on one or more computers. Returns object collection, each corresponding to a session. object properties: ComputerName, UserName, SessionName, ID, State ID refers to RDP session ID. State refers to RDP session State .Parameter ComputerName If absent, function assumes localhost. .Parameter State Filters result by one or more States Valid options are: Disc Conn Active Listen .EXAMPLE Get-SBRDPSession -ComputerName MyPC -State Disc | FT This example lists disconnected RDP sessions on the computer MyPC in table format. Sample output: UserName State SessionName ID ComputerName ——– —– ———– — ———— Disc services 0 MyPC .EXAMPLE Get-SBRDPSession -state Active,Disc | FT This example lists RDP sessions on the local machine, and returns those with State Active or Disc in table format. Sample output: UserName State SessionName ID ComputerName ——– —– ———– — ———— Disc services 0 PC1 samb Active rdp-tcp#73 2 PC1 .Example Get-SBRDPSession xhost11,xhost12 | FT This example lists RDP sesions on the computers xHost11 and xHost12 and outputs the result in table format. Sample output: UserName State SessionName ID ComputerName ——– —– ———– — ———— Disc services 0 xhost11 Conn console 1 xhost11 samb Active rdp-tcp#10 2 xhost11 Listen rdp-tcp 65536 xhost11 Disc services 0 xhost12 Conn console 1 xhost12 Listen rdp-tcp 65536 xhost12 .EXAMPLE Get-SBRDPSession (Get-Content .\computers.txt) Disc -Verbose | FT This example reads a computer list from the file .\computers.txt and displays disconnected sessions In this example .\computers.txt contains: PC1 PC2 PC3 Sample output: VERBOSE: Computer name(s): "xhost13" "xhost14" "xhost16" VERBOSE: Filtering on state(s): Disc VERBOSE: Reading RDP sessions on computer "xhost13" VERBOSE: Reading RDP session: ==> services 0 Disc VERBOSE: Reading RDP session: ==> console 1 Conn VERBOSE: Reading RDP session: ==> rdp-tcp 65536 Listen VERBOSE: Reading RDP sessions on computer "xhost14" VERBOSE: Reading RDP session: ==> services 0 Disc VERBOSE: Reading RDP session: ==> console 1 Conn VERBOSE: Reading RDP session: ==> samb 2 Disc VERBOSE: Reading RDP session: ==> rdp-tcp 65536 Listen VERBOSE: Reading RDP sessions on computer "xhost16" VERBOSE: Reading RDP session: ==> services 0 Disc VERBOSE: Reading RDP session: ==> console 1 Conn VERBOSE: Reading RDP session: ==> rdp-tcp#73 samb 2 Active VERBOSE: Reading RDP session: ==> rdp-tcp 65536 Listen UserName State SessionName ID ComputerNam ——– —– ———– — ———– Disc services 0 PC1 Disc services 0 PC2 samb Disc 2 PC2 Disc services 0 PC3