Jump to content

Recommended Posts

Posted

Hello There.

 

Either i have forgotten something, or something isnt working im sure its the former.

 

dsadd user "CN=JLennon06,OU=Ward,OU=Year 7,OU=Students,DC=swhschool,DC=local" -samid JLennon06 -fn John -ln Lennon -display "John Lennon" -pwd imbornagain -desc "Year 7" -memberof "CN=Students,CN=Users,DC=swhschool,DC=local" -hmdir "\\fileserver\home\$username$" -hmdrv H: -profile \\swhschool\netlogon\swhprof3 -loscr all_log.bat -mustchpwd yes

 

When i run this command, the user is created in the OU i want, but the username in the AD home drive path remains as \\fileserver\home\$username$ rather than resolving to the actual username specified in the samid.

 

Can anyone help?

Posted

nah $username$ is supposed to be a token specifically for the DS Commands, %username% would just give it the username of the currently logged on user (the person who runs the script).

 

 

Cheers

Posted
nah $username$ is supposed to be a token specifically for the DS Commands, %username% would just give it the username of the currently logged on user (the person who runs the script).

 

 

Cheers

 

Might be worth checking if $username$ is case sensitive as with "%" signs it is. Easy enought to try Try $Username$ and $UserName$

Posted

Its a bug in the DSADD portion of the software winthin Windows Server and has been there for a while.

 

The way that I got around it was to do 3 seperate scripts 1 DSADD and then 2 DSMODS as you can query the user once added and the pass info via the query into the user details and MODify it.

 

If you need the scripts I used I can post them up.

 

As of yet M$ have recognised the problem but have yet to fix it.

Posted

Thanks, i guess :wink:

 

Well at least i know now. That was driving me ICTNUTS.

 

Im sure it used to work.

 

 

Its a bug in the DSADD portion of the software winthin Windows Server and has been there for a while.

 

The way that I got around it was to do 3 seperate scripts 1 DSADD and then 2 DSMODS as you can query the user once added and the pass info via the query into the user details and MODify it.

 

If you need the scripts I used I can post them up.

 

As of yet M$ have recognised the problem but have yet to fix it.

Posted

I havent known it to work at all as it is the method I have used for the past 5 years to add the new intake of students and to move certain students around during the year.

 

Far quicker than using the GUI aswell.....

  • 2 weeks later...
Posted

any chance you can post them up or pm me them ( Not sure if you can do attachments via pm )

 

Either way if thats ok ?

 

Thanks

 

I am back in school on the 8th Jan 07 I'll get them posted up then, don't have a copy of them at home sorry...

Posted

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

dsadd user "CN=JLennon06,OU=Ward,OU=Year 7,OU=Students,DC=swhschool,DC=local" -samid JLennon06 -fn John -ln Lennon -display "John Lennon" -pwd imbornagain -desc "Year 7" -memberof "CN=Students,CN=Users,DC=swhschool,DC=local" -hmdir "\\fileserver\home\%%a" -hmdrv H: -profile \\swhschool\netlogon\swhprof3 -loscr all_log.bat -mustchpwd yes

)

 

Add the for loop above to your code and create a CSV file (createusers.csv) in the same location as the script.

 

The loop "for /f "Tokens=1,2,3,4,5,6,7,8 Delims=," %%a in (createusers.csv) do" populates each vaiable %%a through to %%h (1 to 8) with the value of the comma seperated values in the createusers.csv file

 

You can use as many vairables as you like eg: %%a,%%b....%%h and place them anywhere in the dsadd command.

 

Also if you want to add more than one user, simply put them on the next line in the CSV file. I use a similar script to create all my users even if I am just adding one.

Posted

Attached is the Excel spreadsheet I use to create and modify the users.

 

I have placed comments troughout so it should be faiely straight forward but give me a shout if you get stuck.

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...