Jump to content

Recommended Posts

Posted

Hi

 

I am not very experienced in Active Directory and will appreciate if anyone can help me to do the following task:

 

a) Create bulk users ( users will be P1 to P1000 for pupils and T1 to T100 for teachers.

 

b) Create their home folders .

 

C) Share those folders.

 

d) Set the permissions on the folders

 

Does anyone have a script that will automate this ?

 

Many thanks!

Posted

for /f "Tokens=1,2,3,4,5,6,7,8 Delims=," %%a in (newusers.csv) do 

(dsadd user "cn=%%a,ou=%%b,ou=%%g,dc=evolvedit,dc=com" -samid %%a -upn %%[email protected] -fn %%d -ln %%e -display "%%d %%e" -hmdir "%%f%%a\My Documents" -hmdrv h: -pwd "ChangeMe" -canchpwd yes -pwdneverexpires no -memberof "cn=%%g,ou=%%g,dc=yourdomain,dc=com"

md "D:\User Home Folders\%%g\%%b\%%a\My Documents"
cacls "D:\User Home Folders\%%g\%%b\%%a" /T /G "%%a":F /e
cacls "D:\User Home Folders\%%g\%%b\%%a" /T /G Administrators:F /e
cacls "D:\User Home Folders\%%g\%%b\%%a" /T /E /R Everyone
cacls "D:\User Home Folders\%%g\%%b\%%a" /T /E /R Users

echo added user %%a >> userlog.txt

)

 

I use something like this. This script reads the vaiables from a CSV file (each user on a separate line)

 

DSADD adds the user account to active directory, sets the password, and places the user account in the correct OU

 

You can specify other options using DSADD see this artical.

 

http://technet2.microsoft.com/windowsserver/en/library/8d37ecb0-ac28-4e05-aa05-da82dc36b54b1033.mspx?mfr=true

 

The home folder is created below a shared home folder for staff and students respectively so you don’t have to worry about sharing or setting share permissions.

 

CACLS sets the ACL information on the home folder.

  • 2 weeks later...
Posted

Hi djm968

 

Unable to send you a PM as I am getting some smtp error message.

 

Anyway with regards to the password I would like it to be left blank.

 

Thanks and look forward to your input.

 

Regards

 

Calapso

Posted

Hi Networkgeezer

 

I agree with you about security. I work in a primary school and this is for primary school kids in Key Stage 1 who have trouble remembering passwords hence no password required.

 

For Key Stage 2 I will require passwords though.

 

Thanks for your input and any help on this subject would be welcome!...I am new to this!

 

Regards

 

Calapso

  • 2 weeks later...
Posted
for /f "Tokens=1,2,3,4,5,6,7,8 Delims=," %%a in (newusers.csv) do 

(dsadd user "cn=%%a,ou=%%b,ou=%%g,dc=evolvedit,dc=com" -samid %%a -upn %%[email protected] -fn %%d -ln %%e -display "%%d %%e" -hmdir "%%f%%a\My Documents" -hmdrv h: -pwd "ChangeMe" -canchpwd yes -pwdneverexpires no -memberof "cn=%%g,ou=%%g,dc=yourdomain,dc=com"

md "D:\User Home Folders\%%g\%%b\%%a\My Documents"
cacls "D:\User Home Folders\%%g\%%b\%%a" /T /G "%%a":F /e
cacls "D:\User Home Folders\%%g\%%b\%%a" /T /G Administrators:F /e
cacls "D:\User Home Folders\%%g\%%b\%%a" /T /E /R Everyone
cacls "D:\User Home Folders\%%g\%%b\%%a" /T /E /R Users

echo added user %%a >> userlog.txt

)

 

I use something like this. This script reads the vaiables from a CSV file (each user on a separate line)

 

DSADD adds the user account to active directory, sets the password, and places the user account in the correct OU

 

You can specify other options using DSADD see this artical.

 

http://technet2.microsoft.com/windowsserver/en/library/8d37ecb0-ac28-4e05-aa05-da82dc36b54b1033.mspx?mfr=true

 

The home folder is created below a shared home folder for staff and students respectively so you don’t have to worry about sharing or setting share permissions.

 

CACLS sets the ACL information on the home folder.

 

Hi

 

I am struggling with the format of the CSV file. How do the viriables %%a , %%b , %%g etc tie in with the csv file format? I will appreciate if anyone can show a sample line that would tie in with the above code.

 

I tried technet articles but still struggling. :roll:

 

I have a new server to build next week so a speedy response would be much appreciated.

 

Many thanks.

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...