Solved

Logon scripts for different locations

Posted on 2004-09-07
11
205 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VCSA join to Active directory 10 106
CA server migration from Windows 2003 to Windows 2012 R2 12 113
File Server Migration from 2003 to 2008R2 3 62
Can’t delete a file 14 141
by Batuhan Cetin In this article I will be guiding through the process of removing a failed DC metadata from Active Directory (hereafter, AD) using the ntdsutil tool in a Windows Server 2003 environment. These steps are not necessary in a Win…
I guess it is not common knowledge to most Wintel engineers/administrators: If you have an SNMP-based monitoring system in your environment (and it's common to have SNMP or Syslog) it's reasonably easy to enable monitoring of the Windows Event logs,…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

867 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

19 Experts available now in Live!

Get 1:1 Help Now