From: Jordan on
I have a program that is Terminal Server aware. When you log in it records
where you are connecting from. For a non-terminal session you will see

user1 on computer1
user2 on computer2
etc....

When you run the program in a terminal sessions it shows:

user1 on computer1 from remote1
user5 on computer3 from remote7
etc.

The program was designed by idiots so instead of storing the pointer to the
licens file in the registry under HKLM\Software\DumbProgName, they stuck it
under HKCU\Software\DumbProgName. Then they went one step further where
connecting from a remote session forces the license key to be read from a
formation of local computer name and remote computer name like:

HKCU\Software\DumbProgName\##COMPUTER1##REMOTE1

I want to write a script so that at logon this key and the needed values are
created however I do not know how to obtain the remote computer name via the
command line or a vbs script. How can I do this on both a 2003 Terminal
Server and an XP RDP sesion? I need both because some users will be using
the Terminal Server and some uses will VPN in and RDP to their own box.



From: Jordan on
I found that I can get what I need by querying the %CLIENTNAME% variable or
querying HKCU\Volitile Environment\CLIENTNAME on a Terminal Server, however
it appears that this is does not get set when connecting to an XP computer
on RDP.

Somehow the application I am using is getting this information and I need to
get it on an XP machine to automate the configuration of the application.



"Jordan" <none(a)here.com> wrote in message
news:%23zFcMMkmKHA.2188(a)TK2MSFTNGP04.phx.gbl...
>I have a program that is Terminal Server aware. When you log in it records
>where you are connecting from. For a non-terminal session you will see
>
> user1 on computer1
> user2 on computer2
> etc....
>
> When you run the program in a terminal sessions it shows:
>
> user1 on computer1 from remote1
> user5 on computer3 from remote7
> etc.
>
> The program was designed by idiots so instead of storing the pointer to
> the licens file in the registry under HKLM\Software\DumbProgName, they
> stuck it under HKCU\Software\DumbProgName. Then they went one step
> further where connecting from a remote session forces the license key to
> be read from a formation of local computer name and remote computer name
> like:
>
> HKCU\Software\DumbProgName\##COMPUTER1##REMOTE1
>
> I want to write a script so that at logon this key and the needed values
> are created however I do not know how to obtain the remote computer name
> via the command line or a vbs script. How can I do this on both a 2003
> Terminal Server and an XP RDP sesion? I need both because some users will
> be using the Terminal Server and some uses will VPN in and RDP to their
> own box.
>
>
>