I am trying to write a batch file that will map network drives according to what group the user is in. I am using the IFMEMBER.exe from the Resource kit. Here is part of the script.
:ACCT
@ifmember Accounting
@if not errorlevel 1 goto AGENTS
@net time \\bdc1 /set /yes
@net use e: /del
@net use e: \\bdc2\droot
@net use g: /del
@net use g: \\bdc2\pdq
@net use k: /del
@net use k: \\bdc1\rbc
@net use w: /del
@net use w: \\bdc1\droot
@net use x: /del
@net use x: \\imagessvr\imagewrt
@net use y: /del
@net use y: \\imagessvr\images
:AGENTS
@ifmember Agents
@if not errorlevel 1 goto AUDIT
@net time \\bdc1\ /set /yes
@net use x: /del
@net use x: \\imagessvr\imagewrt
@net use y: /del
@net use y: \\imagessvr\images
I am not sure if I am using the ERRORLEVEL correctlly. It does not map any drives when I put the "if not" line in. If the user is in the agents group, the errorlevel would be 1 correct??? Our users are in more than one group. Would the errorlevel keep going up or is it reset everytime. Any help would be greatly apperciated.
:ACCT
@ifmember Accounting
@if not errorlevel 1 goto AGENTS
@net time \\bdc1 /set /yes
@net use e: /del
@net use e: \\bdc2\droot
@net use g: /del
@net use g: \\bdc2\pdq
@net use k: /del
@net use k: \\bdc1\rbc
@net use w: /del
@net use w: \\bdc1\droot
@net use x: /del
@net use x: \\imagessvr\imagewrt
@net use y: /del
@net use y: \\imagessvr\images
:AGENTS
@ifmember Agents
@if not errorlevel 1 goto AUDIT
@net time \\bdc1\ /set /yes
@net use x: /del
@net use x: \\imagessvr\imagewrt
@net use y: /del
@net use y: \\imagessvr\images
I am not sure if I am using the ERRORLEVEL correctlly. It does not map any drives when I put the "if not" line in. If the user is in the agents group, the errorlevel would be 1 correct??? Our users are in more than one group. Would the errorlevel keep going up or is it reset everytime. Any help would be greatly apperciated.