Jump to content
Welcome to our new Citrix community!
  • 2

Getting 'Clientname' from Windows 10

Richard Todd1709157785


I thought I'd post this here as I couldn't find much on the interweb for this use case issue I came across.


In the environment I'm currently working in, there's a number of legacy applications that look to get the 'hostname' of the machine it's running on for licensing purposes.  However, as these are non-persistent Windows 10 VDA's, the actual 'hostname' the app needs is the actual endpoint name (e.g. thinclient name).

Under an RDP or XenApp session, the 'CLIENTNAME' environment variable would normally be populated.  But in a XenDesktop session - this variable is not created.


In Windows 7, we would trick AppV packages by scripting a copy of the value from HKLM:\Software\Citrix\Ica\Session\ClientName to

  • HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName and
  • HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName


Unfortunately in Windows 10, we found that applications making the GetComputername calls to KERNELBASE.DLL and NTDLL.DLL no longer worked with this trick.  Instead, it reads the NETBIOS name directly from a cache.


Fix:  Set the '_CLUSTER_NETWORK_NAME_' environment variable with the clientname (from HKLM:\Software\Citrix\Ica\Session\ClientName).   (note the underscores in the variable name)


Here's a launch script that demos this:


$nameVal = Get-ItemProperty -Path HKLM:\Software\Citrix\Ica\Session\
$env:_CLUSTER_NETWORK_NAME_ = $nameVal.ClientName
start-process "K:\APP\Start.exe"


Refer to https://ss64.com/nt/hostname.html

Link to comment

1 answer to this question

Recommended Posts

  • 0

Good day Richard,


I was wondering if you can maybe assist.

I have a very similar situation where a company application needs the HostName of the endpoint logging into a published application. 

It then needs to take that hostname and edit a file in the users profile and populate it with that hostname for licensing purposes. It can be done after the application has launched.


I have tried lots of different scripts but none successful as the registry uses random session ID's under the Volatile Environment key. I have used a VBscript to see if i can get the sessionID and then match it up, but also not successful.


The environment is CVAD 1912 LTSR

Server 2016

One published application




Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...