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!

Help: How to detect if client is logging in with a citrix clint 1

Status
Not open for further replies.

EgilHansen

IS-IT--Management
Jan 3, 2006
16
Hello

I would like to detect when I client is connecting to a Windows Terminal Server with a Citrix client?

Best regards
Egil Hansen.
 
This determines werther or not the user is currently running under Citrix or Terminal Server, I posted this some time ago on the VB.Net forum

Code:
Dim Sh, Clientname, Computername
Set Sh = WScript.CreateObject("WScript.Shell")
Clientname =  UCase(Sh.ExpandEnvironmentStrings("%Clientname%"))
Computername =  UCase(Sh.ExpandEnvironmentStrings("%Computername%"))

If (Clientname <> "%CLIENTNAME%") And (Clientname <> Computername) Then
    IsTSSession = True
Else
    IsTSSession = False
End If

If IsTSSession Then
    WScript.Echo "This is a Terminal Services session"
Else
    WScript.Echo "This is NOT a Terminal Services session"
End If

An alernative (Delphi) solution is:

Code:
function IsRemoteSession: Boolean;
const
  sm_RemoteSession = $1000; { from WinUser.h }
begin
  Result := GetSystemMetrics(sm_RemoteSession) <> 0;
end;

You will need to convert this to VBScript - but it should be straightforward enough (I think).

Hope this helps.

[vampire][bat]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top