Solved

Logon scripts for different locations

Posted on 2004-09-07
11
204 Views
Last Modified: 2010-04-19
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?
0
Comment
Question by:bdipaolo99
  • 3
  • 3
  • 3
  • +2
11 Comments
 
LVL 57

Expert Comment

by:Pete Long
ID: 11998836
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
 
LVL 57

Expert Comment

by:Pete Long
ID: 11998854
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
 
LVL 22

Expert Comment

by:Bartender_1
ID: 11998859
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
 
LVL 22

Expert Comment

by:Bartender_1
ID: 11998875
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
 
LVL 83

Expert Comment

by:oBdA
ID: 11998912
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 57

Expert Comment

by:Pete Long
ID: 11999162
unsure - never tested it on 9x - though Im guessing that if the domain accepts NTLM authentication then it should work.
0
 
LVL 22

Expert Comment

by:Bartender_1
ID: 11999228
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
 

Author Comment

by:bdipaolo99
ID: 11999885
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
 

Author Comment

by:bdipaolo99
ID: 11999994
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
 
LVL 104

Accepted Solution

by:
Sembee earned 250 total points
ID: 12000389
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
 

Author Comment

by:bdipaolo99
ID: 12007922
Thanks, that's exactly what I was looking for.  I tried something similar one time but couldn't get it right.  Thanks again!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Organizations create, modify, and maintain huge amounts of data to help their businesses earn money and generally function.  Typically every network user within an organization has a bit of disk space to store in process items and personal files.   …
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 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

10 Experts available now in Live!

Get 1:1 Help Now