Check for Terminal server

G

Guest

Guest
Archived from groups: microsoft.public.vb.general.discussion,microsoft.public.vb.winapi,microsoft.public.windowsnt.terminalserver.applications (More info?)

Hi,

How can we in code check if our application is currently running on a
Terminal Server ?

We need to do some optimizations if the program detects that it's running on
TS.

Using VB6 so API calls are no problem.

David
 
G

Guest

Guest
Archived from groups: microsoft.public.vb.general.discussion,microsoft.public.vb.winapi,microsoft.public.windowsnt.terminalserver.applications (More info?)

Check the existence and value of this registry key:

HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\TSAppCompat
0 is Remote Administration, 1 is Application Server mode

Note that this key will let you see what mode the server is in.
You can not switch between the modes just by toggling the key.

--
Vera Noest
MCSE,CCEA, Microsoft MVP - Terminal Server
http://hem.fyristorg.com/vera/IT
*----------- Please reply in newsgroup -------------*

"David De Bono" <er_fortsatt@hotmail.com> wrote on 13 jun 2005:

> Hi,
>
> How can we in code check if our application is currently running
> on a Terminal Server ?
>
> We need to do some optimizations if the program detects that
> it's running on TS.
>
> Using VB6 so API calls are no problem.
>
> David
 
G

Guest

Guest
Archived from groups: microsoft.public.vb.general.discussion,microsoft.public.vb.winapi,microsoft.public.windowsnt.terminalserver.applications (More info?)

Call IsOS(OS_WIN2000TERMINAL).

Review IsOS for other values you can query that may more precisely cover the
specific terminal services case you're interested in, but which you didn't
detail in your question.

You can also call GetVersionEx and check the value returned in wSuiteMask
for VER_SUITE_TERMINAL and/or VER_SUITE_SINGLEUSERTS.

If you're only testing, using VerifyVersionInfo with arg2 = VER_SUITENAME
can make your life easier.

"David De Bono" <er_fortsatt@hotmail.com> wrote in message
news:OKJtYXAcFHA.1504@TK2MSFTNGP15.phx.gbl...
> Hi,
>
> How can we in code check if our application is currently running on a
> Terminal Server ?
>
> We need to do some optimizations if the program detects that it's running
> on TS.
>
> Using VB6 so API calls are no problem.
>
> David
>
 
G

Guest

Guest
Archived from groups: microsoft.public.vb.general.discussion,microsoft.public.vb.winapi,microsoft.public.windowsnt.terminalserver.applications (More info?)

Here's a simple way if you are checking from the user's standpoint:

Bases on SESSIONNAME env variable. You might need to test to make sure it is
not XP and is truly a server first so you dont get a false positive from
XP's remote desktop feature.

if environ$("SESSIONNAME")="CONSOLE"
Terminal services enabled, but is running via console
if environ$("SESSIONNAME")="RDP#"
Terminal services enabled, and running in a RDP session
if environ$("SESSIONNAME")=""
No term services enabled

-Harry Bates





"David De Bono" <er_fortsatt@hotmail.com> wrote in message
news:OKJtYXAcFHA.1504@TK2MSFTNGP15.phx.gbl...
> Hi,
>
> How can we in code check if our application is currently running on a
> Terminal Server ?
>
> We need to do some optimizations if the program detects that it's running
on
> TS.
>
> Using VB6 so API calls are no problem.
>
> David
>
>
 
G

Guest

Guest
Archived from groups: microsoft.public.vb.general.discussion,microsoft.public.vb.winapi,microsoft.public.windowsnt.terminalserver.applications (More info?)

Hi,

That worked perfectly.

David

"Vera Noest [MVP]" <Vera.Noest@remove-this.hem.utfors.se> wrote in message
news:Xns967492BCA2F38veranoesthemutforsse@207.46.248.16...
> Check the existence and value of this registry key:
>
> HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\TSAppCompat
> 0 is Remote Administration, 1 is Application Server mode
>
> Note that this key will let you see what mode the server is in.
> You can not switch between the modes just by toggling the key.
>
> --
> Vera Noest
> MCSE,CCEA, Microsoft MVP - Terminal Server
> http://hem.fyristorg.com/vera/IT
> *----------- Please reply in newsgroup -------------*
>
> "David De Bono" <er_fortsatt@hotmail.com> wrote on 13 jun 2005:
>
>> Hi,
>>
>> How can we in code check if our application is currently running
>> on a Terminal Server ?
>>
>> We need to do some optimizations if the program detects that
>> it's running on TS.
>>
>> Using VB6 so API calls are no problem.
>>
>> David