Today I was given a task to get a list of all connected users to terminal servers. So, I thought I would share the process to list terminal server/citrix ica users and kill the required sessions when needed.
List ICA/RDP Sessions:
If we want to get a list of all ICA and RDP sessions list we can
1) Connect to the server and use the command, query session.
2) Use any tool to get the list of sessions.
I got a good tool on internet which is, TSListUsers.
TSListUsers is a command line utility to list both the currently connected and disconnected users, hostname, IP address and RDP session number on either the local or a remote Windows Terminal Server/RDP Server
To list the users, you need to have the following abilities:
– NetBios access to the server
– Permissions allowing you to Query RDP session information (if you can log into the TS, you should have this by default)
– Terminal Services/RDP should be running on the target host
TSListUsers.exe /? to get the Help text
TSListUsers.exe to query a target Terminal Server
TSListUsers.exe with no paramters to query the local host
You can download TSListUsers from here.
Posted in home.fnal.gov
Kill ICA/RDP Sessions:
Similarly to kill any ica sessions remotely we can
1) Connect to the server and use the command, reset session session_id.
2) Use any tool to kill sessions remotely.
The tool which I use to kill sessions remotely is, TSLogoff.
Thanks to Warren Simondson for building such a nice and handy tool.
TSLogoff V3 is a command-line tool to logoff Citrix or Terminal Server Sessions from a particular server within a Domain.
This utility was written to replace the command LOGOFF.EXE currently found in the MS Windows Operating System. This utility offers an extra feature that will be of benefit to all admins – the * (ALL) switch. Using this switch, an admin can logoff all users on a Citrix/TS server with one command. This command can also be used in a script.
This utility is FREEWARE and was written by Warren Simondson of Ctrl-Alt-Del IT Consultancy, Australia. http://www.ctrl-alt-del.com.au
Thankyou to the WINDOWS SDK available from http://msdn.microsoft.com/downloads
TSLOGOFF [ username | sessionid | * | /DISC | /AXCON] [/SERVER:servername]
Use Tslogoff.exe /? for more information.
TSLOGOFF with no parameters will logoff the current session.
You can download the tool here.
Posted in ctrl-alt-del