Bypassing User Account Properties Logon Scripts

Hi guys,
Hope you can help.
We are starting to get a pretty complicated Citrix Setup here at my work, and Im finding Im having to edit existing user logon scripts so that when they log on to Citrix Servers, some of the things such as mapping their network drives in their user logon scripts dont run only when they log on to Citrix Servers.

Is there any way by group policy to:

When users logon to certain machines only, dont run the user's logon script as defined in their user account properties in Active Directory, but do run them for all other machines?

This would definitely save a lot of time.

Thanks in advance.

Simon
LVL 1
Simon336697Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

oBdACommented:
If all of your machines are running XP or Server 2003, you could use a logon script from a group policy and do this with a WMI filter.

WMI filtering using GPMC
http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/ServerHelp/6237b9b2-4a21-425e-8976-2065d28b3147.mspx

Create, import, export, copy, and paste WMI filters
http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/ServerHelp/78745b09-3404-4e10-91f2-c44fb884726d.mspx

Link a WMI filter to a Group Policy object
http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/ServerHelp/15f9f234-89ee-498b-a008-8ccb45c270e0.mspx

But it's probably easier to just check in the logon script for the computer name. If the user logs on to a terminal session, the computer name will be the name of the citrix server.
So if your logon script is in batch, this could look like that (you could obviously share parts of the logon script as well):

@echo off
setlocal
if /i "%Computername%"=="YourCitrixServer" goto TSLogon

:: *** User is logging on to a workstation; regular logon script:
:: ...
goto :leave

:TSLogon
:: *** User is logging on to a terminal server; special logon script:
:: ...
:leave
Simon336697Author Commented:
Hi oBdA!

Once again youre a legend.

oBdA,

If I have Citrix Servers with a naming convention of:

TERMSERV01
TERMSERV02
TERMSERV03
TERMSERV04
and so on,

Is it possible in your statement:

if /i "%Computername%"=="YourCitrixServer" goto TSLogon

to have a wildcard for certain characters

eg. TERMSERV0*

so you dont need to keep adding new lines for each new computer name?

Thank you so much for your help.

Simon
oBdACommented:
Yes, that's possible:
if /i "%Computername:~0,8%"=="TERMSERV" goto TSLogon
The %Variable:~x,y% syntax will expand to y characters, starting at position x in the variable (the first character is at position 0).
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

Simon336697Author Commented:
Thanks oBdA,

So does this mean:

if /i "%Computername:~0,8%"=="TERMSERV"

will include:

TERMSERV01
down to
TERMSERV09?

Sorry to be a pain here. Just a bit unsure of the variable.

If we had more than 9 TERMSERV

eg. TERMSERV12, TERMSERV 25

How would you include everything from TERMSERV01.............TERMSERVxx where xx could be 25 for example.

Youve been really helpful already, so I dont expect a response. Thanks so much oBdA!

Simon
oBdACommented:
That will cover everything that has "TERMSERV" as the first 8 characters (including TERMSERVONE, TERMSERVXYZ or TERMSERV9999).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Simon336697Author Commented:
Thanks again oBdA!

Simon
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.