Using APIs to Identify Remote Citrix/WTS Clients

  • 7021484
  • 05-Dec-2002
  • 01-Apr-2018

Environment

Reflection for UNIX and OpenVMS 2008
Reflection for IBM 2008
Reflection for IBM version 14.x
Reflection for HP version 14.x
Reflection for UNIX and OpenVMS version 14.x
Reflection for ReGIS Graphics version 14.x
Microsoft Windows Server 2008 with Terminal Services (with or without Citrix XenApp)
Microsoft Windows 2003 Server with Terminal Services (with or without Citrix MetaFrame)
Microsoft Windows 2000 Server with Terminal Services (with or without Citrix MetaFrame)

Situation

This technical note details how to use APIs to determine the remote IP address, Citrix username, or computer name of individual Citrix/Windows Terminal Server (WTS) clients in Citrix/WTS environments.

Resolution

Why Obtain This Information?

When running in a Citrix/Windows Terminal Server (WTS) environment, users are not assigned individual IP addresses; instead, all users share the same IP address or group of IP addresses (in a Citrix farm).

In some situations, the system administrator may want to identify individual remote Citrix/WTS clients. For example, the administrator may want to assign remote computers to specific print queues based on the Citrix/WTS client's remote IP address, Citrix user name, or computer name.

In this example, the administrator needs to determine the Citrix/WTS client's remote information. Once this information is obtained, the administrator can create a table that associates the remote client with the correct printer name. For example:

IP Address
Computer Name
Assigned Printer
129.23.30.49
SallyR
Printer_NYC
149.29.23.46
PetraK
Printer_Berlin

This table can be stored in a host program, a VBA script, or on the network, and must be updated any time the remote IP address or computer name changed.

The remote IP address, user name or computer name can be determined by using the API calls specified in this technical note.

Note: In this example, the remote computers must be configured with unique, static IP addresses or computer names. Assigning a printer to individual IP addresses or computer names using a table is impractical if the remote computer is configured to dynamically obtain its IP address from DHCP, or if the computer is renamed frequently.

Reflection APIs

Reflection includes six API calls that can be used to determine the Citrix/WTS client's remote IP address, client PC name or Citrix/WTS user name. These API calls can be used with the following Reflection products:

Reflection for UNIX and OpenVMS 2008
Reflection for HP with NS/VT 14.x
Reflection for UNIX and OpenVMS 14.x

Description
Reflection Object(s)
Reflection Call
Returns your client IP address for connection to a Citrix server.
Terminal (Reflection 2008)
Session (Reflection 14.x)

.CitrixIPAddress
Returns the PC name value for a PC connected to a Citrix server.
Terminal (Reflection 2008)
Session (Reflection 14.x)

.CitrixPCName
Returns the user name value for a connection to a Citrix server.
Terminal (Reflection 2008)
Session (Reflection 14.x)

.CitrixUserName
Returns your client IP address for connection to a WTS server.
Terminal (Reflection 2008)
Session (Reflection 14.x)

.WTSPAddress
Returns the PC name value for a PC connected to a WTS server.
Terminal (Reflection 2008)
Session (Reflection 14.x)

.WTSPCName
Returns the user name value for a connection to a WTS server.
Terminal (Reflection 2008)
Session (Reflection 14.x)

.WTSUserName

Reflection for IBM 2008
Reflection for IBM 14.x

Description
Reflection Object(s)
Reflection Call
Returns your client IP address for connection to a Citrix server.
Session
.CitrixIPAddress
Returns the PC name value for a PC connected to a Citrix server.
Session
.CitrixPCName
Returns the user name value for a connection to a Citrix server.
Session
.CitrixUserName

Sample Script – Using Reflection API Calls: WTSIPAddress, WTSPCName and WTSUsername.

The following sample script applies to Reflection for UNIX and OpenVMS 2008. It uses API calls, .WTSIPAddress, WTSPCName and .WTSUsername, to determine the IP address, the PC name and WTS user name of the remote client machine.

Sub GetWTSInfo()
   With ThisTerminal
   MsgBox "Your client IP is " & .WTSIPAddress & _
   ". Your WTS logon name is " & .WTSUserName & _
    ". Your client PC Name is " & .WTSPCName & "."
   End With
End Sub

Additional Information

Legacy KB ID

This document was originally published as Attachmate Technical Note 1711.