Page 1 of 1

computer name (RESOLVED)

Posted: Mon Oct 07, 2019 9:04 pm
by paulcarpenter
we currently use this code below to get the Computer Name, this is used by our system to identify where output is sent dependant on the pc id.

however we have a number of thin client users that are using terminal server, in this case we are getting the computer name of the server, we need to be able to get the name of the allocated device, how could this be done ?


Does anyone know how this might be achieved?

* get terminal number
Use Builtin(GET_REGISTRY_VALUE) With_Args(HKEY_LOCAL_MACHINE SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName ComputerName) To_Get(#toterm #IO£STS)

Re: computer name

Posted: Tue Oct 08, 2019 2:03 am
by atostaine
You'd probably get a quicker response on a terminal server forum. I found this for VMWare, maybe there is something like this for TS

https://blogs.vmware.com/euc/2009/05/vm ... ables.html

Re: computer name

Posted: Tue Oct 08, 2019 2:45 am
by paulcarpenter
I have found a solution to getting the correct computer name, for normal computers and thin client as follows

i have attached a system variable to this function which gets the correct results

Function Options(*DIRECT *ALP_SYSTEM_VARIABLE *NOMESSAGES)

Define_Com Class(#XPRIM_OSUtil) Name(#OSUtil)
Define_Com Class(#PRIM_BOLN) Name(#Found)

#SYSVAR£AV := #OSUtil.GetEnvironmentVariable( 'CLIENTNAME' #Found )
If Cond(#found = false)
#SYSVAR£AV := #OSUtil.GetEnvironmentVariable( 'COMPUTERNAME' #Found )
Endif

Return