I am making a simple script for a network where ever a homefolder is created for every user. Making the users + putting them in the correct group works perfectly but as soon as I add the homefolder part it only executes once.
This script is called 9 times in another script but it only works once.
rem ****** %1 username
rem ****** %2 password
rem ****** %3 group
net user %1 %2 /ADD
net user %1 /logonpasswordchg:no
net user %1 /active:yes
net user %1 /expires:NEVER
net user %1 /times:M-F,8-18
net user %1 /passwordchg:no
net group %3 %1 /add
C:
cd \School\Homefolders\Leerlingen
md %1
echo Y| cacls C:\School\Homefolders\Leerlingen\%1 /G %1:C administrators:F
cd..
cd..
cd..
cd..
C:
I just created a similar example and had the same problem caused by changing the directories. You also have an extra “cd ..” statement. Try just using the following:
I’m also assuming as it otherwise gets called multiple times that you’ve remembered to use a call statement in the batch file that calls that one.