get rid of if errorlevel 1 goto Plantops doesn't make sense.
Main Topics
Browse All TopicsI'm trying to get "ifmember" to work properly in an NT login script. It worked fine until I added another ifmember statement and now I'm getting a syntax error and I don't know what it is. I've tested different syntaxes, but now I'm not exactly sure of the correct way. Below is what I got. What happens is the drive to MAS500_Reports always maps, but the Plantops never does. I've seen some sample login scripts use quotes for the groups, others not.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
The error is probably in line 14, "if not errorlevel1".
That aside, you have two labels ":PLANTOPS", and the result checking required some changes.
Quotes are only required if the group name contains a space; but it's a good practice to add them anyway, so that you get used to it.
The script below should pause at the end, so that you can see error messages.
ifmember.exe is in the same folder as the script?
"%~dp0" should expand to the current script's (%0) *D*rive and *P*ath.
Are you sure you copied the script exactly as posted?
- How are you running that script?
- What OS are you running this script on?
- Is ifmember.exe in the same folder as the script?
- What is the result when you run
ifmember.exe /list
Do you get a correct list of your group membership?
I just copy and pasted the script from this post so it should be exact.
I have the script on both NT servers in the Netlogon share. I was testing 2 ways - via login and just opening the batch file.
The first OS I was originally testing on was Win98 - when you asked what OS I then tested on an XP machine. The XP machine mapped the drives for both groups, even though it was only a member of the plantops group.
ifmember IS in the same folder as the script.
I tried running ifmember.exe /list on the xp machine and it couldn't find the file, because the file is only on the nt server. So I copied the ifmember.exe to the XP desktop, ran the /list and the appropriate groups displayed. Then I tested again by logging out and back in again and it worked as expected!
So - do the desktops also need a copy of ifmember.exe locally? (I copied to windows\system32)
Having it in the script's folder should work, at least for XP/W2k; that's what the "%~dp0ifmember.exe" does.
I have no idea whether ifmember will run correctly on Win98. "%~dp0" or anything else that requires the NT shell instead of the few plain batch commands DOS supports won't work for sure.
If you really want to support a DOS based OS in a logon script, have a look at Kixtart (http://www kixtart.org/) instead. This allows some sort of compatible logon script that should run on both OSs.
Business Accounts
Answer for Membership
by: thenonePosted on 2009-09-28 at 08:37:14ID: 25440230
PLANTOPS
ifmember "PLANTOPS"
if errorlevel 1 goto PLANTOPS
if not errorlevel 1 goto NEXT
add the domain example ifmember "mydomain\plantops"