Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ifmember.exe loginscripts

Status
Not open for further replies.

lengoo

IS-IT--Management
Jan 15, 2002
381
0
0
GH
HI all,
I am trying to simplify my login scripts using the ifmember.exe application. I have set up a whole load of groups in AD and the idea of the login script is that it checks to see if the user is part of the group, if he/she is then they get a drive mapped.
The thing is, people can be members of multiple groups and I can't get the script working this way!

@echo off
:it
ifmember.exe "IT Group"
if not errorlevel 1 goto finance
net use l: "\\server1\IT"

:finance
ifmember.exe finance
if not errorlevel 1 goto licence
net use g: \\server1\finance

:licence
ifmember.exe Licencedrive
net use f: \\server1\License

:quit

Hmm, any ideas how I should be doing this script?
Thanks
 
Don't use the goto. Try

ifmember.exe "IT Group"
if not errorlevel 1 net use l: "\\server1\IT"
ifmember.exe finance
if not errorlevel 1 net use g: "\\server1\finance"
ifmember.exe Licencedrive
if not errorlevel 1 net use f: "\\server1\License"

And see what that gives you.
 
Thanks Castor.. however, all the drives got mapped in this case.. any ideas where I'm going wrong?
 
What happens when you run your original script? Try running it manually from the cmd prompt and see what errors if any are reported and post here.

-------------------------------

If it doesn't leak oil it must be empty!!
 
HI guys
I find that all the drives are mapped with Castors modification..

My script on the otherhand didn't map any drives!

Thanks for helping!
 
Oops - my bad! I got the logic all wrong - it should be:

ifmember.exe "IT Group"
if errorlevel 1 net use l: "\\server1\IT"
ifmember.exe finance
if errorlevel 1 net use g: "\\server1\finance"
ifmember.exe Licencedrive
if errorlevel 1 net use f: "\\server1\License"

Give it a whirl.
 
Hi Castor66
I really appreciate your efforts.. however, really weird, it's still mapping all the drives!? I really don't get this!?
 
I just put a similar script together for testing on my domain here and it works fine. Are you sure the user you are testing with is not a member of all those groups?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top