
Script to run when you're on Citrix or Terminal Server but not on-premises (or vice versa)
Although it may seem a bit simple, I'm forced to have to post this, since many people have asked me for it and to put it here… How is it free… 😉
Well, is as simple as a script that will be executed at the login login of the users of our Active Directory, through policies or GPOs. There are many times that we want users to run a certain script when they're on Citrix but not when they're on-premises, or the other way around 😉 when they are in the local that they execute a certain script, but when they are in Citrix or Terminal Services they are not.
This would be the script, Now everyone modifies and puts what they need, as simple as:
[SourceCode]@ echo off
if %sessionname%==Console (GOTO :Console) else (GOTO :Citrix)
:Console
Echo are you normal, without being TS or Citrix, So run whatever you want.
GOTO :The end
:Citrix
echo Estás either in TS or in Citrix, So run whatever you want.
GOTO :The end
:The end
echo Agur[/SourceCode]