Solved

Login Scripts & Citrix

Posted on 2010-08-22
11
836 Views
Last Modified: 2012-05-10
Hi All,

I have just installed a new XenApp Farm and I am having some issues with login scripts.

Basiscally our network login scripts do everything, map drives, add registry settings, printers and some other bits, which works fine on the network but is causing some issues when logging onto the Citrix Environment.

Is there a way for the login script to detect that the login is happening on a citrix server and then run a different login script?

Thanks very much.

Paul
0
Comment
Question by:essexboy80
11 Comments
 
LVL 36

Assisted Solution

by:Carl Webster
Carl Webster earned 166 total points
ID: 33496734
Put your Citrix servers in a separate OU and Block Inheritance.
0
 
LVL 83

Expert Comment

by:oBdA
ID: 33498551
You can check the registry whether the machine is a terminal server or not and then run any combination of branching in the same script or calling external scripts.
The key to query is the REG_DWORD value "TSAppCompat" in "HKLM\System\CurrentControlSet\Control\Terminal Server"; if it's 1, it's a terminal server, 0 if not.
Example for a batch script:
for /f "tokens=3" %%a in ('reg query "HKLM\System\CurrentControlSet\Control\Terminal Server" /v "TSAppCompat" ^| find /i "TSApp"') do set /a IsTerminalServer=%%a

echo Terminalserver: %IsTerminalServer%

Open in new window

0
 
LVL 35

Assisted Solution

by:Joseph Daly
Joseph Daly earned 166 total points
ID: 33506064
Also another possible way of doing this would be to check the computer names that the login script is running on. Something this at the beginning of the login script should do it.

This script will match the computername and if it matches jump to the citrix login scripts.

This code is the key if /I "%computername:~0,4%"=="xxxx"

What that does is matches the letters of a computername to your terminalserver. So if youir terminal server was named termserv1 you would put

if /I "%computername:~0,9%"=="termserv1"

If you had multiple terminal servers with similar names say termserv1 thru termserv5 you could do below and it would match all of them.

if /I "%computername:~0,8%"=="termserv"
if /I "%computername:~0,4%"=="xxxx" GOTO endbat

if /I "%computername:~0,8%"=="xxxxxxxx" GOTO endbat

if /I "%computername:~0,4%"=="xxxx" GOTO terminalserver



Normal login scripts go here



:terminalserver



Citrix login scripts go here.

Open in new window

0
 
LVL 1

Author Comment

by:essexboy80
ID: 33565952
Hi,

So this is now my login script :

%logonserver%\netlogon\kix32.exe %logonserver%\netlogon\kixtart.kix

%logonserver%\netlogon\Shortcuts.cmd

Basically am callign the Kix Script and then calling some PERL Scripts.

So given this is a logon.cmd file, what can I put in here before the KIX that checks if the user is logging into a Citrix Server and if they are go to a different script.

Thanks

Paul
0
 
LVL 83

Accepted Solution

by:
oBdA earned 168 total points
ID: 33565993
Something like this (use CALL to start another batch script from a batch script, at least if you want to return to the first batch script!):
for /f "tokens=3" %%a in ('reg query "HKLM\System\CurrentControlSet\Control\Terminal Server" /v "TSAppCompat" ^| find /i "TSApp"') do set /a IsTerminalServer=%%a

if "%IsTerminalServer%"=="1" goto TerminalserverLogon

REM *** User is logging on to a workstation or member server

%logonserver%\netlogon\kix32.exe %logonserver%\netlogon\kixtart.kix

CALL %logonserver%\netlogon\Shortcuts.cmd



goto :eof

REM *** User is logging on to a terminal server

:TerminalserverLogon

%logonserver%\netlogon\kix32.exe %logonserver%\netlogon\terminalserver.kix

goto :eof

Open in new window

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:essexboy80
ID: 33566375
Hi,

What is the code in these lines below doing, just so I can understand it

for /f "tokens=3" %%a in ('reg query "HKLM\System\CurrentControlSet\Control\Terminal Server" /v "TSAppCompat" ^| find /i "TSApp"') do set /a IsTerminalServer=%%a
if "%IsTerminalServer%"=="1" goto TerminalserverLogon

0
 
LVL 83

Expert Comment

by:oBdA
ID: 33566515
It queries the registry value "TSAppCompat" in "HKLM\System\CurrentControlSet\Control\Terminal Server" and sets the environment variable "IsTerminalServer" to this value (0 or 1).
If it's 1, it then jumps to the label ":TerminalserverLogon".
0
 
LVL 1

Author Comment

by:essexboy80
ID: 33992014
Great Thanks All
0
 
LVL 9

Expert Comment

by:Suhas .
ID: 37313514
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
 
LVL 83

Expert Comment

by:oBdA
ID: 37307497
Sorry, but http:#33496734 is not a valid solution. GPO based logon scripts are a user setting; blocking inheritance for computer accounts will not prevent logon scripts from running (unless combined with a loopback GP processing policy in replace mode). In addition, it would not prevent the legacy logon script specified in the user's AD properties from running.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

After several days of searching and hunting for limited documentation, I wanted to share this guide to hopefully save someone the hassle of trying to figure this out on their own. I have tested this on Xendesktop 7.1 and PS 4.5 running simultaneous…
#Citrix #Citrix Policies #XenDesktop #VDI #POC #Citrix Univeral Printer Driver #Citrix UPD
How to install and configure Citrix XenApp 6.5 - Part 1. In this video tutorial we have explained step by step installation of Citrix XenApp 6.5 Server on Windows Server 2008 R2 is explained in this video. We have explained the difference between…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now