Wanting to view ALL connected users with IP addresses.

Nov 19, 2015 at 10:29 AM
We have 20 RDS servers which all users log onto. Currently i use this script to match users to IP address and it is working perfectly for each server. What i'm looking for is if there is a way to view all users and IP's from the full collection of 20 servers?

Thanks
Craig
Coordinator
Nov 20, 2015 at 8:36 AM
Sure, give this a try:

$computers = 'rds1','rds2','rds3'

$computers | Foreach-Object {
Get-TSSession -ComputerName $_
} | Select-Object @{n='ComputerNames';e={$_.Server.ServerName}},UserName,IPAddress
Nov 20, 2015 at 12:40 PM
Thank you very much! Works perfectly. Just need to work out how to get the server names to show. Doesn't seem to pull them through. Not desperately needed though.
Coordinator
Nov 22, 2015 at 2:48 PM
The code I posted should display the server name under the ComputerName column.