Justin-Credible Posted November 30, 2005 Share Posted November 30, 2005 Does anyone know if its possible to obtain the Client Name (that is, the host name) of a user connected to a terminal server remotely (with a script or command line tool)? You can obtain this information graphically from the Terminal Services Manager snap-in (see screenshot).The Query User command (or QWINSTA) only returns the Session Name.Alternatively, remotely reading the user's %CLIENTNAME% environment variable would work as well. Link to comment Share on other sites More sharing options...
cluberti Posted November 30, 2005 Share Posted November 30, 2005 Does "query user" give you what you need? Link to comment Share on other sites More sharing options...
Justin-Credible Posted December 1, 2005 Author Share Posted December 1, 2005 Unfortunately, no.The closest thing it gives to client name is session name (RDP-TCP#xx), but I need the actual host name that the client is connected from. Link to comment Share on other sites More sharing options...
cluberti Posted December 1, 2005 Share Posted December 1, 2005 You'll probably have to check out the WTS API's on MSDN, then, as that's the only other way I know of getting info from a TS machine.http://www.microsoft.com/msj/1099/terminal/terminal.aspx Link to comment Share on other sites More sharing options...
Justin-Credible Posted December 1, 2005 Author Share Posted December 1, 2005 I've tried using those (WTSManager.dll) in a vbs script, and the script works when run from the terminal server itself. But I can't find a way to get the script to work remotely from another computer.Looking through the article I noticed it mentions using "WTSOpenServer( LPTSTR pServerName)" to connect to a different server, but I haven't had luck getting it to work yet. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now