Tuesday, November 15, 2011

Setting the Citrix CLIENTNAME to match the View client host name

Often, applications will use the Citrix client name to assign location based resources (printers, for example).  In the case of a Citrix XenApp session running from a Windows based View session, location awareness is lost because Citrix client name assumes the Windows host name of the VM, not the endpoint (a thin client or View running on a physical desktop).

There are two ways that I have seen to address this - and personally I have a preference for one of those methods, but you can decide which works best for you.

First, it's important to understand a couple of things.

The View agent on the VM will capture information about the client and store that data in the hive "HKCU\Volatile Environment\" and one of the keys in that hive is "ViewClient_Machine_Name".

Citrix clients store the CLIENTNAME attribute in "HKLM\Software\Citrix\ICAClient\CLIENTNAME".

By default, the Citrix plugin installs with dynamic client name enabled.  This means that the CLIENTNAME reg is populated with the host name of the host running the client.  In other words, by default CLIENTNAME will be the VM's OS host name.

One method of changing the CLIENTNAME to the endpoint host name is to grab the reg key "ViewClient_Machine_Name" and replace the "CLIENTNAME" key with that string.  A script to do just that may look like this:

Option Explicit
Dim SysVarReg, Value
Set SysVarReg = WScript.CreateObject("WScript.Shell")
value = SysVarReg.RegRead("HKCU\Volatile Environment\ViewClient_Machine_Name")
SysVarReg.RegWrite "HKLM\Software\Citrix\ICAClient\CLIENTNAME", value

You would want this script to run on connection and reconnection, so when a roaming desktop user changes endpoints you are updating the CLIENTNAME to match for location awareness.

To use this method, you would need to reinstall the Citrix plugin on the VM to disable dynamic client name.

I like this approach because it's elegant and simple to troubleshoot.  I would recommend using BGinfo to add three bits of info to the VM desktop wallpaper to help validate that the CLIENTNAME is correct and to aid in any troubleshooting.  For example, I would have the following appear in the lower left corner in small font on the desktop:

  View VM -
  View Client -
  Citrix Client Name -

The other method would be to leave Citrix dynamic client name enabled and change the host name of the VM on connect/reconnect to match the endpoint host name (or include the endpoint host name in the VM host name).  I'm not a huge fan of this approach because it involves constantly changing the host name of the VM which could impact other applications as well as complicate troubleshooting.  You also need to make sure that the TCPIP name is changed as well, resulting in a DNS update if you're running dynamic DNS.

I do have access to a script to perform a VM host name change, but since I didn't write it I don't want to post it here.  I will check with the author to see if I can add it to this post later, but the script above should give you a start on creating that script.

4 comments:

  1. Thank you, John.
    This is something that has bothered me for a while. I've used BGinfo at another installation and it is handy, but I want my endpoints to return correctly in Desktop Director, so I can support my users without asking them to read an IP or Host-name to me. Again THANK YOU.

    ReplyDelete
  2. Glad you found that useful, thanks for the feedback.

    ReplyDelete
  3. This hasnt worked since upgrading to Windows 7 Client 3.4. Anyone know the new method to set the ClientName?

    ReplyDelete
  4. The Citrix reg keys have moved with 64 bit Windows and recent Citrix Receivers:



    32 Bit Windows:
    HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\ICA Client\Engine\Lockdown Profiles\All Regions\Lockdown\Client Engine

    64 Bit Windows:
    HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Citrix\ICA Client\Engine\Lockdown Profiles\All Regions\Lockdown\Client Engine

    ReplyDelete