Jump to content

Recommended Posts

Posted
I need a way for a bat/vbs file to detect if its running from within a Citrix Metaframe session/published application enviroment. Anyone know how?
Posted

Look for the SESSIONNAME variable. This will either say RDP-TCP#xyz or ICA-TCP#xyz

 

 

@Cybernerd

COMPUTERNAME is the environmental variable and HOSTNAME is the command. Unfortunately you can't do `HOSTNAME` quite so easily on the Windows command line as you can in *nix.

 

Inany case the value is the server name will be the same under both presentation protocols.

Posted

I see, therefore something like:

 

echo %sessionname% | find /I "ICA-tcp"
if %errorlevel%==0 goto (GOTO:EOF)

echo %sessionname% | find /I "RDP-Tcp"
if %errorlevel%==0 goto (GOTO:EOF)

 

should do the trick then.

Posted

'echo %computername%' does return the hostname, but here the command 'hostname' also returns the hostname.

 

How about when you publish the application, you publish the bat/vbs script that then calls the actual aplication

Posted

@Geoff

But surely you want the test to produce two different outcomes?

 

@Cybernerd

In your orginal post you said 'echo %HOSTNAME%'

This would produce nothing as HOSTNAME is not a defined variable but the name of command which produces the same result as echo %COMPUTERNAME%

 

Anyway it would an ineffective test as Citrix now runs on top of Windows 200x Terminal Serices so COMPUTERNAME/HOSTNAME wouldn't be able to distingusih between an RDP or ICA/Metframe session.

Posted

@NetworkGeezer your quite right, heat has probably caused my brain to stop working correctly. My original post was wrong but I didn't realise.

 

Anyway it would an ineffective test as Citrix now runs on top of Windows 200x Terminal Serices so COMPUTERNAME/HOSTNAME wouldn't be able to distingusih between an RDP or ICA/Metframe session.

 

I see what you mean, I was thinking of distinguishing between TS/RDP and non TS/RDP applications.

Posted

@CyberNerd: No worries m8. It happens to the best of us at one time or another :)

 

@ 1 and all:

Another difference between ICA and RDP is that for an ICA session the CLIENTNAME variable returns the name defined in the WFCNAME.INI file on the client PC where as RDP returns the actual host name as reported by host OS on the client PC.

 

This means you can change client names in ICA without having to do anything in Active Directory.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...