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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IFMEMBER..

Status
Not open for further replies.

redman71

IS-IT--Management
Joined
Mar 15, 2002
Messages
329
Location
US
Is anyone familiar with the "IFMEMBER" script? I'm using it in a batch file to map drives, but it's not working properly.
 
its very easy to use:

ifmember "domain\username"
if errorlevel 1 net use f: \\server\sharename

if errorlevel 0 echo the user is NOT a member of the group

your script should look something like this.

good luck
 
Thanks...I've actually made it into a batch file and i'm using groups..

@ECHO OFF
NET USE R: \\SERVERNAME\SHARE
NET USE S: \\SERVERNAME\SHARE

IFMEMBER Personel
if not errorlevel 1 goto quit
NET USE M: \\SERVERNAME\SHARE\PERSONEL

:quit

but it doesn't work
 
you should put the group name between double quotes and if possible also use the domain name like this:

@ECHO OFF
NET USE R: \\SERVERNAME\SHARE
NET USE S: \\SERVERNAME\SHARE

IFMEMBER "domain\Personel"
if not errorlevel 1 goto quit
NET USE M: \\SERVERNAME\SHARE\PERSONEL

:quit

also make sure that the directory which contains the ifmember utility is in the path

you can do this by adding the path line to your batch file:


@ECHO OFF
set path=%path%;c:\path\to\dir\containing\ifmember\utility
NET USE R: \\SERVERNAME\SHARE
NET USE S: \\SERVERNAME\SHARE

IFMEMBER "domain\Personel"
if not errorlevel 1 goto quit
NET USE M: \\SERVERNAME\SHARE\PERSONEL

:quit



 
Thanks!
I'll let you know how it works
 
Does IFMEMBER work on Windows 9X work stations? GlennA
MIS, IT, Gofer






 
When I map a drive using IFMEMBER, it seems to stay mapped even when the user is taken out of the specific group.

For example:
If I set
IFMEMBER "domain\Personel"
if not errorlevel 1 goto quit
NET USE M: \\SERVERNAME\SHARE\PERSONEL

when I take the person out of the Personel group, the when the person logs back on, Personel is still mapped to M. Is there a way to disconnect or have it recheck the script?
 
thats right, because windows remembers the mappings. if you don't like this behavior, add the following command in your script above the drive mappings:

net use /persistent:no
NET USE M: \\SERVERNAME\SHARE\PERSONEL

 
Does WinXP work different when loggin onto a domain? Cuz I've logged onto the same domain with a WinPro box and the drives map fine, but when I log onto the domain with a WinXP box, with the same account, no drives get mapped.

Strange!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top