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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Citrix Login Script

Status
Not open for further replies.

kasandoro

IS-IT--Management
Feb 11, 2003
11
US
Here's the scenario.

I have about 200 users who log in to a certain domain "NA". They each use a login script to map their drives. When they log into citrix, I need to bypass the script entirely. Here's what I've done so far.

I created an environment variable on the server called CITRIX and gave it a value of 1. I have tried having their scripts call the following:

if %citrix%==%citrix% goto :logon
if %citrix%==1 goto :end

All it tells me is either "goto was not expected at this time" or ":logon was not expected at this time"

Any ideas how I can accomplish this? If I type "echo %citrix%" at the server, it returns "1" (no quotes).

Any help would be appreciated!

--Kas
 
Try this instead:

[red]if exist %SystemRoot%\system32\MFADMIN.EXE goto end [black]

This will check to see if the file MFADMIN.exe Exists in that path. If it does, that pretty much means it's a Citrix server.
You can create your own file too if you want and then just check for that file instead.

Dave Namou, MCSE CCEA
 
I think your batch should like the following. If I understand what you are trying to do.

if "%citrix%"=="" goto :logon
if "%citrix%"=="1" goto :end

MikeL
 
Here is a left field one for you.

Use Kixtart and have your login script call this script.
You can do anything Dos lets you + a whole lot more. Its also got some pretty good documentation and its relativley intuative, I love it, got me out of more hole than a place with lots of holes. Comes as part of the Resource Kit or search for Kixtart on the world wide waste of time.

Use the @WKSTA variable

and basically if @WKSTA = "your citrix server name" then goto end.

Cheers
Scott
 
Hi,

It's actually :-

if "%citrix%"=="" goto logon
if "%citrix%"=="1" goto end

The :logon and :end are to define in your script file where to jump to.

Cheers,
Carl.
 
Actually you can use the label :END or just END, as part of the GOTO. It's not as common to use the ":", but it's legal syntax.

MikeL

 
Using :)) before a label is legal but all your doing when you use the :)) I believe is "calling" that label. Which means it comes back to where it was called from after End Of File (EOF)

Dave Namou, MCSE CCEA
 
I use the variables %WINSTATIONNAME% and %SESSIONNAME% to make sure the user is not on a Terminal Server or Citrix Server Windows XP uses the %SESSIONNAME% variable but a person logging directly on to the box will = "Console".

if not "%WINSTATIONNAME%"=="" goto tserve
if "%SESSIONNAME%"=="Console" goto NT_XP
if not "%SESSIONNAME%"=="" goto tserve
if (%OS%) == (Windows_NT) goto NT_XP

The last line with %OS% sends all NT, 2000, XP boxes to the NT_XP lable and allows the next line in the batch file to work with Windows 9.X boxes then exit.

:tserve
%logonserver%\netlogon\kix32.exe %logonserver%\netlogon\ctx.kix

(from the label tserver I call a seperate KIXTART script
that will not run patches or try to copy the
KIX executables locally...)

:NT_XP
%windir%\kix32.exe %logonserver%\netlogon\yourkix.kix
From this lable I also copy the kix32.exe locally (it runs faster this way)

I know this is a completely different way but I do have a huge amount of boxes that are running TS without Citrix in Admin Mode and this forces them to a striped down script also...


 
Using the "many ways to skin a cat" theme, you could also check out my example kix script at faq48-3661

Basically I do a:
$OS = OSVersion ;// Determine OS Version //
IF $OS = "CITRIX"
EXIT
EndIf

and this calls a function as follows:

Function OSVersion()
$os=""
$os_dos=@dos
$os_product=ReadValue("HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions","ProductType")
$os_productSuite=ReadValue("HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions","ProductSuite")
SELECT
CASE (INSTR(UCASE($os_productSuite), "TERMINAL")) ; - Windows 2K Terminal Server
$os="CITRIX"
CASE ($os_product <> &quot;WinNT&quot;) AND ($os_dos = &quot;5.1&quot;) ; - Windows XP Server
$os=&quot;SERVER&quot;
CASE ($os_product = &quot;WinNT&quot;) AND ($os_dos = &quot;5.1&quot;) ; - Windows XP Professional
$os=&quot;XP&quot;
CASE ($os_product <> &quot;WinNT&quot;) AND ($os_dos = &quot;5.0&quot;) ; - Windows 2000 -
$os=&quot;SERVER&quot;
CASE ($os_product = &quot;WinNT&quot;) AND ($os_dos = &quot;5.0&quot;) ; - Windows 2000 Professional -
$os=&quot;W2K&quot;
CASE ($os_product = &quot;LANMANNT&quot;) OR ($os_product = &quot;ServerNT&quot;)
$os=&quot;SERVER&quot;
CASE $os_product = &quot;WinNT&quot;
$os=&quot;NT&quot;
ENDSELECT
$OSVersion=$OS
EndFunction

Cheers
 
Did anyone ever suggest that you turn on Loopback processing (GPO) in Active Directory??? Put your CTX servers in their own OU and then you can define an entirely differnt environment for just those who log into/onto the Citrix servers....??? Just a thought!

Brandon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top