Logon scripts for different locations

We have two locations that users can logon at.  Each location has it's own local servers which the users access through mapped drives.  The drives are mapped through logon scripts.  There is one script for Office A and another script for Office B.

The problem is that although the servers are Windows 2003 the workstations are mixed - XP, 2000 and 98 - so no Group Policy.

How can I configure the users to use Script A for Office A and Script B for Office B?
bdipaolo99Asked:
Who is Participating?
 
SembeeConnect With a Mentor Commented:
You need to detect which site they are on. If the network is setup correctly you should have different IP ranges. Use that to detect them.

http://www.amset.info/loginscripts/locations.asp

The sample script from above is below.

Simon.

rem Subnets for reference
rem UK subnet: 192.168.22.254
rem US subnet: 192.168.11.254
rem Grab IP address and dump to a file
ipconfig >"%userprofile%\ipconfig.txt"
echo Checking for your location
rem Seaching for default gateway in IP dump above
findstr "192.168.22.254" "%userprofile%\ipconfig.txt"
if not errorlevel 1 goto UK
echo Not UK
goto next
:next
findstr "192.168.11.254" "%userprofile%\ipconfig.txt"
if not errorlevel 1 goto US
echo not US
goto other
:UK
rem UK settings
goto :next
:US
rem US settings
goto :next
:other
rem Other settings (for VPN etc)
goto next
:next
rem More Commands
:end
0
 
Pete LongTechnical ConsultantCommented:
Ifmember.exe: User Membership Tool
User Membership (IfMember) is a command-line tool that checks whether or not the current user is a member of a specified group. It is typically used in Windows logon scripts and other batch files.
IfMember uses its own process token to discover group membership, rather than querying the relevant domain controller each time it runs. While this has a significant performance benefit, it means that IfMember will only be aware of groups on the local computer, on the computer's domain, and on trusted domains and will report on membership as it was when that token was obtained.
File Required
•      Ifmember.exe
Files included in the 2K3 Resource Kit
http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en
Download and run rktools.exe then extract it to a folder.
0
 
Pete LongTechnical ConsultantCommented:
so you can put the users at site A in a group called site_a

then in the login script

ifmember site_a then net use x: \\server\site_a_folder\

etc
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
Christopher McKayMicrosoft Network AdministratorCommented:
use a script like this:

ping <server@location1>|find "reply from">nul
if not errorlevel=1 goto server1

ping <server@location2>|find "reply from">nul
inf not errorlevel=1 goto server2
goto noserver

:server1
call scripta.bat
goto end

:server2
call scriptb.bat
goto end

:noserver
echo Error!!!! the location could not be determined, no script will be launched.
goto end
:end

If you put the server names in the correct order, this script should ping the server, and launch the correct script based on which server responds.

Hope this helps!

:o)

Bartender_1
0
 
Christopher McKayMicrosoft Network AdministratorCommented:
Hmmmm.... beat me to the punch PeteLong,
I didn't know about the ifmember tool.
It looks much easier than my attempt to determine site based on server response.

Cheers!

:o)

Bartender_1
0
 
oBdACommented:
Assuming that your users don't switch from Office A to Office B or vice versa on a regular basis, you can simply assign all the users in Office A the logon script A, and the logon script B to the users in Office B.
Put both scripts into %Systemroot%\sysvol\sysvol\your.domain.name\scripts.
Highlight all regular users from Office A in the ADUC MMC. Right-click and choose "Properties". Go to the "Profile" tab, check the box in front of "Logon script", enter the name of your logon scipt A (no path, just the script name).
Do the same for the Office B users.

As for ifmember.exe: can anybody confirm that this actually runs on Win9x?
0
 
Pete LongTechnical ConsultantCommented:
unsure - never tested it on 9x - though Im guessing that if the domain accepts NTLM authentication then it should work.
0
 
Christopher McKayMicrosoft Network AdministratorCommented:
http://www.microsoft.com/resources/documentation/WindowsServ/2003/all/techref/en-us/Default.asp?url=/Resources/Documentation/windowsserv/2003/all/techref/en-us/ifmember.asp

The above link states that ifmember requires XP and Server 2003. But it doesn't specifically state that it will NOT work on 2000 or 9x.

:o)

Bartender_1
0
 
bdipaolo99Author Commented:
Thanks to all for the quick response.  The users frequently switch between locations so just specifing scripts in ADUC profiles won't cut it.

I will try IfMember on 98 and see.  Thanks in advance!
0
 
bdipaolo99Author Commented:
I just thought of something.  Since the users frequently switch between offices wouldn't that mean that they would be switching between groups too?  So then Ifmember wouldn't work.
0
 
bdipaolo99Author Commented:
Thanks, that's exactly what I was looking for.  I tried something similar one time but couldn't get it right.  Thanks again!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.