Windows Thread, DSADD in Technical; 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" ...
-
19th December 2006, 11:44 AM #1
- Rep Power
- 0
DSADD
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?
-
-
IDG Tech News
-
19th December 2006, 11:51 AM #2 Re: DSADD
I think it should be %username%, not $username$
-
-
19th December 2006, 12:06 PM #3
- Rep Power
- 0
Re: DSADD
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
-
-
20th December 2006, 10:55 AM #4
- Rep Power
- 15
Re: DSADD

Originally Posted by
disinfo 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$
-
-
20th December 2006, 11:07 AM #5 Re: DSADD
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.
-
-
21st December 2006, 11:10 AM #6
- Rep Power
- 0
Re: DSADD
Thanks, i guess
Well at least i know now. That was driving me ICTNUTS.
Im sure it used to work.

Originally Posted by
ICTNUT 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.
-
-
21st December 2006, 03:50 PM #7 Re: DSADD
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.....
-
-
21st December 2006, 06:19 PM #8 Re: DSADD
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
-
-
1st January 2007, 08:04 PM #9 Re: DSADD
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...
-
-
2nd January 2007, 07:18 PM #10 Re: DSADD
"\\fileserver\home\$username$"
That's the only place you don't have an explicit name i.e. why didn't you make that:
"\\fileserver\home\JLennon06"
-
-
3rd January 2007, 02:47 PM #11 Re: DSADD
Code:
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.
-
-
3rd January 2007, 05:54 PM #12 Re: DSADD
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.
Last edited by ICTNUT; 24th July 2008 at 02:08 PM.
-
SHARE:
Similar Threads
-
By tosca925 in forum Windows
Replies: 8
Last Post: 23rd May 2011, 08:31 PM
-
By PEO in forum How do you do....it?
Replies: 3
Last Post: 26th October 2007, 06:30 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules