Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Roaming Profile Terminal Server Login Script

Status
Not open for further replies.

silver2kgt

Technical User
Nov 18, 2003
19
US

Here is my scenario.

We are wanting to implement roaming profiles, but all of our users in remote branches will be logging in through a terminal server session. What I need is the IP address of the client used to connect to that session so that I can determine what branch they are logging in from to properly assign printers. Each branch is on a different network ie. clients at branch a are 10.1.111.x, the ones at branch b are 10.1.112.x, etc. I can't do this on the branch PC as when the user logs in their login information is passed into an RDP session and logged onto one of our terminal servers. When they close this session, they are logged off of the branch PC.

I have searched on Microsoft's site for WMI classes that I could query once a user connects to a session and there was one called Win32_TSGatewayConnection that looked exactly like what I need, but doesn't seem to return anything (not implemented yet?). Can anyone think of another way to do this or am I out of luck?
 
Forgot to put in my post that our terminal servers are running W2k3 Enterprise (no service packs.)
 
Here’s a script I use to get the Client IP address of the user.

Code:
Set objFarm = CreateObject("MetaFrameCOM.MetaFrameFarm")

objFarm.Initialize(1)

For Each objSession In objFarm.Sessions
  WScript.Echo "User name : " & objSession.UserName
  WScript.Echo "IP Address: " & objSession.ClientAddress
Next

Hope this helps you going in the right direction.

 
The code you listed must be for Citrix as is doesn't work for Windows terminal services. Thanks for the post, though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top