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

returning thin client machine name

Status
Not open for further replies.

CorySnyder

Technical User
Jun 3, 2003
10
0
0
US
I need to use the name of a thin client machine in an application. When I use the Environment.Machinename class, it returns the name of the Terminal Server. Does anyone know a way to return the name of the thin client machine instead?

Thanks
 
maybe this helps
Imports System.Windows.Forms.SystemInformation
i used ComputerName
 
Unfortunately, that still returns the terminal server name. I know you can get the thin client name from a command prompt if you type echo %clientname%, is there a way I can work this into my code? I'm really new to programming so forgive me if this sounds stupid.

Thanks
 
Would there be a way to pass the %clientname% as a commandline parameter when I open the application, and somehow use the reults in the app?
 
does anyone know of a good place to go to find this information? ive posted this a lot of boards and have not received any information.

Thanks
 
I use the following VB to do this...

If Trim(Environ(&quot;CLIENTNAME&quot;)) <> &quot;&quot; And UCase(Trim(Environ(&quot;CLIENTNAME&quot;))) <> &quot;CONSOLE&quot; Then MsgBox Trim(Environ(&quot;CLIENTNAME&quot;))

If the client is running TS, then the clients machine name is returned.
 
This is what I have been using, I'm not sure if it's different in VB and VB.Net, it may be exactly what you're doing. Under what circumstances would it return &quot;CONSOLE&quot;? Perhaps I need to consider this in my code. Thanks

' get the workstation name...

machinename = Environment.GetEnvironmentVariable(&quot;clientname&quot;)
' if not a thin client, previous step returns nothing,
' this will get the name of a fat client...
If machinename = Nothing Then
machinename = Environment.GetEnvironmentVariable(&quot;computername&quot;)
End If

This will make machinename the name of the thin client computer if it is thin client, or the name of the thick client workstation if it isn't.
 
The CLIENTNAME environment is set to &quot;CONSOLE&quot; on some xp workstations after they have had a thin client session running. I'm not sure why this happens, and only on some workstations (could be version of XP?), so I've put this in to overcome this problem.

I have my fingers crossed that no-one on our network has a PC named CONSOLE :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top