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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Client Name from Citrix

Status
Not open for further replies.

DroopyA

Programmer
Aug 5, 2003
52
0
0
US
I need to get the Computer Name of the computer connecting to a Citrix server.

For example. I'm on computer "ClientMachine" and I connect to citrix and run my application. My Application needs to return "ClientMachine".

Anybody know where this information is stored or how I can get it through VB6 code? I checked the .ina files, but it only had login names.
 
Now then I must check, but there is a way, I would search this forum for it if I was you whilst I trawl.

[blue]Arguably the best cat skinner around ! [/blue]

Cheers
Scott
 
Yeah, I've been digging around in this forum, but I haven't found anything yet. You're help would be a huge help... I've been stuck on this for 2 days now.
 
Well as a first it is certainly in the Local Host Cache ldb

[blue]Arguably the best cat skinner around ! [/blue]

Cheers
Scott
 
It is? I searched for *.ldb and didn't find anything of any value. I also cheacked for *.mdb which looked like it might help, but upon inspection turned out little more then your basic .ina files.

I'm not too familure with Citrix so maybe I misunderstood you. Whats the name of the file I need and where is it?
 
I have found it. It is in the registry.

HKLM\Software\Citrix\ICAClient

ClientName=

[blue]Arguably the best cat skinner around ! [/blue]

Cheers
Scott
 
Strange, I don't have that registry setting. I have all the files you named, but no "ClientName" string. Here's a screenshot if you want to look for yourself.

droopya.8k.com/trash/citrixregscreenshot.jpg

I searched the registry for clientname. I got a few returns, but the values always read "domain-[screenName]". Unfortunitly, "domain" isn't the name of the client machine.

I read somewhere that there is a "ClientName" Environment variable. Any idea how I get citrix to return EvnironmentVariables to me?
 
Set MyClientName As String

MyClientName = Environ$("CLIENTNAME")

Should work!

Carl.
 
If you click tools/ICA Settings in Programme neighbourhood you can change the name and that should put the entry in your registry.

Hi Carl

[blue]Arguably the best cat skinner around ! [/blue]

Cheers
Scott
 
I tried the Environ$() function first. It worked, but it returned "domain-[screenname]". This "domain" stuff is really starting to get on my nerves.

Going to tools/ICA Settings sounds like a good idea, except I'm just the software developer. I have no control over my clients Citrix settings. If worse comes to worse we'll have to tell them to change it, but at this point that's an "unexceptable" answer. :(

This information has to be somewhere. But where? The code is easy to write, if I only knew where to pull the information from. I might have to call Citrix support, but I would really hate to pay for such an easy answer. Any more ideas as to where this info is?
 
The option in tools allows for a dynamic name or a client name. You must have dynamic names at the moment, that is why it is blank in the registry. It can be set when you install the client.

[blue]Arguably the best cat skinner around ! [/blue]

Cheers
Scott
 
You can use the WTSAPI.DLL but it can be a bit of a pig. Also, if you use this rather than the COM objects Citrix provide, your software will be TS And Citrix compatible!

Have a look on MSDN site at microsoft.com

Carl.
 
There is also MFCOM scripts from the SDK from Citrix.

[blue]Arguably the best cat skinner around ! [/blue]

Cheers
Scott
 
That will be due to the clients using Nfuse to log into the system.

What is in the Registry under

HKEY_CURRENT_USER\Volatile Environment\CLIENTNAME

I think you'll find that to be the same but it will get what you want.

Don't forget - you have got the correct name as it's the PC's clientname and it should be unique on every client.

You can always programatically remove the "domain-" as if it's there, remove it!

The "domain-" will be added by NFuse/Web Inspector. This is configurable and your Citrix Administrator should be able to turn this on/off. Scott will be able to answer that as I don't work in a Citrix environment anymore!

Let us know how you get on!

Cheers,
Carl.
 
So after all this time the best solution we could come up with was:

Have the end user Right Click the Application and "Save Target As" to their desktop. This will create a local ICA file. In this ICA file, we manually change the "ClientName" field to the Machine Name.

To run our application, the end user has to double click this ICA on their desktop. This will launch Citrix, and pass the local machine name to the ClientName space in the registry under "HKEY_CURRENT_USER\Volatile Environment\CLIENTNAME" (Up until now, this field read 'domain-[username]')

Now my app can read the value from that registry to get the local computer name.

It's an answer, but not the best as this still requires the end user to create a file and fill out the information manually. Still though, I want to thank you all for your help. I would have never been able to get this far without it. When I find a real solution I'll post it. Until then, if you got any more ideas don't be afraid to post them. :)
 
There was a simimlar post in this forum a few days ago. My suggestion was to set TS to return username rather than machine name. there is a windows reg hack for this. You create a new key with the name of the app. When the app runs, it will refer to username rather than TS Box name.

Refer to:
These values are set under HKEY_LOCAL_MACHINE\SOFTWARE \Microsoft\Windows NT\CurrentVersion\Terminal Server\Compatibility\ Applications\appname, where appname is the name of the application's executable file. For example, if the executable file name for an application is WINWORD.EXE, the key would be WINWORD.

DOS application 0x00000001
OS/2 application 0x00000002
16-bit application for Windows 0x00000004
32-bit application for Windows 0x00000008
16 or 32-bit application for Windows 0x0000000c

As discussed above, these values set the version to which you want the registry settings to apply.

Hope it helps. ACO
 
There is also a simple way of getting this.

If you log in to you Citrix server using a Desktop session and open a CMD Window then type "set" you will get a list of all the environment variable set for that session.

There is one there called CLIENTNAME and if you type

echo %CLIENTNAME%

the conencting clientname will be returned to you.

You can just use %CLIENTNAME% in you application as this will be set for each user on a session by session basis.

 
clntnfo.exe" will do it. This is available from various thin sources. This returns the ICA Client Name, which is by default the computer name (but can be changed). It returns output in 'ini' file format which can be read by various scripting languages.

e.g.

Example output:

C:\SetDefPrint>clntnfo
[WFClientNFO]
WFClientName=G46-11334
WFClientAddress=150.5.23.89
WFApplicationName=

Example Kix script:

$file="%temp%\clntnfo.tmp"
$clientn=readprofilestring($file,"WFClientNFO","WFClientName")

We use this to set a client default printer based on physical location of PC, not user.

If you can't find the utility, let me know and I'll try and remember where I got it.
 
Here's a script I use;

Set Sh = CreateObject("WScript.Shell")
sys = Sh.ExpandEnvironmentStrings("%CLIENTNAME%")

so sys will equal the clientname. Hope that helps!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top