Page 1 of 2 12>
Topic Options
#184749 - 2008-01-22 07:55 PM How to disable Logon Scripts for Citrix Logons
Mephy Offline
Fresh Scripter

Registered: 2008-01-22
Posts: 18
Ok, I would like to modify my CMD file that calls my KiX logon to NOT run the Logon Script when a user is logging on VIA Citrix. I know Les posted something on this, but I'm not totally sure about it, and I also can't seem to find it again!!!

Any help would be greatly appreciated!

Top
#184750 - 2008-01-22 08:00 PM Re: How to disable Logon Scripts for Citrix Logons [Re: Mephy]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Look in the FAQ forum. You could also set an enviro var on all you rcitrix servers and then do an IF DEFINED in your CMD.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#184751 - 2008-01-22 08:01 PM Re: How to disable Logon Scripts for Citrix Logons [Re: Mephy]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Easiest thing would be

 Code:
if @tssession
    exit 1
endif


at the beginning of your script, but that would also exit on rdp sessions...
_________________________



Top
#184752 - 2008-01-22 08:03 PM Re: How to disable Logon Scripts for Citrix Logons [Re: Jochen]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
That however means that KiX must first load. My option in CMD doesn't need to launch KiX.
 Code:
@echo OFF
REM ****** START CITRIX GENERAL SCRIPT ********
If DEFINED CitrixSvrDomain GOTO CITRIX
GOTO CITRIXEND
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#184753 - 2008-01-22 08:05 PM Re: How to disable Logon Scripts for Citrix Logons [Re: Les]
Mephy Offline
Fresh Scripter

Registered: 2008-01-22
Posts: 18
That's what I want Les. I want it in my CMD so KiX doesn't load at all. So, on your code, I would put it EXACTLY how you put it, but where CitrixSvrDomain is, I would put the Citrix server name?
Top
#184754 - 2008-01-22 08:44 PM Re: How to disable Logon Scripts for Citrix Logons [Re: Les]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Les, wouldn't that then mean that all logon scripts would need to be launched by a batch file first instead of just

WKIX32.EXE myscript.kix


Top
#184755 - 2008-01-22 08:55 PM Re: How to disable Logon Scripts for Citrix Logons [Re: NTDOC]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
That is what the original poster wants right? If on citrix do not start kix not even to detect if it is on citrix and end if it is.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#184756 - 2008-01-22 09:01 PM Re: How to disable Logon Scripts for Citrix Logons [Re: Mephy]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
 Originally Posted By: Mephy
That's what I want Les. I want it in my CMD so KiX doesn't load at all. So, on your code, I would put it EXACTLY how you put it, but where CitrixSvrDomain is, I would put the Citrix server name?


Nope. The batch script Les posted checks to see if the environment variable CitrixSvrDomain holds something and start a specific script if it is or if it is not. So if CitrixSvrDomain is empty you would not be on a citrix session and the regular logon script should be started.

Small example:
 Code:
@echo off
REM ****** START CITRIX GENERAL SCRIPT ********
If DEFINED CitrixSvrDomain GOTO Citrix
GOTO NoCitrix

:Citrix
echo User is on Citrix. Do NOT START kix script
pause
Goto End

:NoCitrix
echo User is not on Citrix. Start kix script
pause
wkix32.exe somescript.kix


:End
Exit



Edited by Mart (2008-01-22 09:39 PM)
Edit Reason: added example
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#184760 - 2008-01-22 10:09 PM Re: How to disable Logon Scripts for Citrix Logons [Re: Mart]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Sorry but as I see that it still used a BATCH file to launch KiXtart which though maybe not a show stopper it still means that all accounts are launched by a BATCH file and not by WKIX32.EXE alone as often suggested.
Top
#184766 - 2008-01-22 10:50 PM Re: How to disable Logon Scripts for Citrix Logons [Re: NTDOC]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Yeah I know and I agree to not use batch file if even remotely possible. Batch files are so 2007 ;\) I'm reconfiguring some stuff to get rid of them in my work environment.

But the original poster stated that he/she wants it in the batch file that starts other scripts if needed.

 Quote:

….
I want it in my CMD so KiX doesn't load at all.
....
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#184767 - 2008-01-22 11:00 PM Re: How to disable Logon Scripts for Citrix Logons [Re: Mart]
Mephy Offline
Fresh Scripter

Registered: 2008-01-22
Posts: 18
Yes, we use a CMD file to launch our KiX Script. I have no control over changing that at this moment, so I need to modify the CMD file to check if they are logging on through Citrix, and if they are, do NOT run the wkix32.exe line at all. Unless there is an easier way to build this check into the KiX script and go from there, doesn't really matter to me as long as it's easy, and works. =) Thanks for the helps guys!
Top
#184770 - 2008-01-22 11:31 PM Re: How to disable Logon Scripts for Citrix Logons [Re: Mephy]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Jochen's suggestion will work just fine in a kix script and the suggestion Les posted work fine from a batch script. It's up to you to choose the one you like and that fits best in you setup.

My personal favourite (besides dumping the batch file) would be to build it into the kix script being started by the batch script.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#184780 - 2008-01-23 01:43 AM Re: How to disable Logon Scripts for Citrix Logons [Re: Mart]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4400
Loc: New Jersey
"Six of one, half-dozen of other" they say in the old country. * ;\)

If you define a System environment variable on the Citrix server, users logging in to the Citrix server will have that variable present. Users logging into desktop systems will not. Thus:

Assume you define IsCitrix = TRUE on the citrix server

CMD/BAT file:
 Code:
If [%IsCitrix%]==[] {
REM Run the Kix login script
Kix32 kixtart.kix
Goto Common
}
REM citrix stuff goes here...

:COMMON
REM commands common to all environments go here...

In Kixtart:
 Code:
; Exit immediatly if IsCitrix is not null
If '%IsCitrix%' Quit 0 EndIf


Personally, I'd add the code to Kix simply because it's easier, and can be placed anywhere. Thus, you could run SOME of the kix script if you wanted to on the Citrix server.

Glenn

* Actually, they say something completely different, but I'd probably be censored here. \:D


Edited by Glenn Barnas (2008-01-24 04:27 PM)
Edit Reason: code typo
_________________________
Actually I am a Rocket Scientist! \:D

Top
#184781 - 2008-01-23 01:59 AM Re: How to disable Logon Scripts for Citrix Logons [Re: Glenn Barnas]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Well that's pretty much how I do it, but was curious if Les had some other ideas or information that maybe I had overlooked.

I just use KiXtart script. We are on fast connections every where that I'm aware of so loading the 262,144 byte file is not a big deal for me.


Top
#184783 - 2008-01-23 02:59 AM Re: How to disable Logon Scripts for Citrix Logons [Re: NTDOC]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
My way is driven by CorpIT demands and their distaste for KiX. They insist that KiX not even get launched. They think when you launch many seamless apps thousands of times a day from dozens of Citrix servers, the seconds it takes KiX to load/parse/exit all add up to man years.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#184797 - 2008-01-23 04:21 PM Re: How to disable Logon Scripts for Citrix Logons [Re: Les]
Mephy Offline
Fresh Scripter

Registered: 2008-01-22
Posts: 18
Ok, so by using this code:

 Code:
; Exit immediatly if IsCitrix is not null
If '%IsCitrix' Quit 0 EndIf


If I put that at the VERY beginning of my KiX script, it will check to see if IsCitrix exists, if it does, the Script is ended, right then and there, before going any further, and if it does NOT exist, the script continues to run normally. Correct?

Ok, one last question, this IsCitrix, is this a Reg Key or what?

Top
#184798 - 2008-01-23 04:36 PM Re: How to disable Logon Scripts for Citrix Logons [Re: Mephy]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4400
Loc: New Jersey
It's an environment var - which is easy to define and check. You could use a reg key if you wish - same concept, different commands.

If you use the environment var, you log onto the Citrix server as an admin, right-click My Computer, choose Properties. On the Advanced Tab, click the Environment Variables button. In the "System Variables" section, click New, enter "IsCitrix" in the Variable Name field, and "1", "yes", "true", or even the server name in the Variable Value field - anything so long as it isn't blank.

Open a command prompt, type "SET" and verify that the variable IsCitrix is present. You must open the command prompt after the change to see it.

If the variable is blank, or not defined, your script runs, if it is defined AND NOT blank, it exits.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#184799 - 2008-01-23 04:43 PM Re: How to disable Logon Scripts for Citrix Logons [Re: Glenn Barnas]
Mephy Offline
Fresh Scripter

Registered: 2008-01-22
Posts: 18
Sounds good. Thanks for all the help guys, if I have any more issues, I'll be back. =), but really, thanks for all the help!
Top
#184813 - 2008-01-24 03:56 PM Re: How to disable Logon Scripts for Citrix Logons [Re: Mephy]
Mephy Offline
Fresh Scripter

Registered: 2008-01-22
Posts: 18
OK, maybe I'm doing it wrong, but I put this code in:

 Code:

; Exit immediatly if Citrix is not null
If '%Citrix' Quit 0 EndIf



Our variable is labeled Citrix..... now, when I run the script locally, it's not running the script past the Citrix part..... I checked my local variables and Citrix does not exist... I even tested it by logging on through the network with the script in place, and it didn't work... am I missing something??

Top
#184814 - 2008-01-24 04:04 PM Re: How to disable Logon Scripts for Citrix Logons [Re: Mephy]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4400
Loc: New Jersey
You need a "%" on both sides of the variable name. Single "%" only works for the special/numbered args - %0-%9, %*, and such.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 581 anonymous users online.
Newest Members
Audio, Hoschi, Comet, rrosell, PatrickPinto
17880 Registered Users

Generated in 0.079 seconds in which 0.028 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org