disinfo Posted December 19, 2006 Posted December 19, 2006 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?
Norphy Posted December 19, 2006 Posted December 19, 2006 I think it should be %username%, not $username$
disinfo Posted December 19, 2006 Author Posted December 19, 2006 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
glensc Posted December 20, 2006 Posted December 20, 2006 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$
ICTNUT Posted December 20, 2006 Posted December 20, 2006 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.
disinfo Posted December 21, 2006 Author Posted December 21, 2006 Thanks, i guess 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.
ICTNUT Posted December 21, 2006 Posted December 21, 2006 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.....
mac_shinobi Posted December 21, 2006 Posted December 21, 2006 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
ICTNUT Posted January 1, 2007 Posted January 1, 2007 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...
PiqueABoo Posted January 2, 2007 Posted January 2, 2007 "\\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"
djm968 Posted January 3, 2007 Posted January 3, 2007 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.
ICTNUT Posted January 3, 2007 Posted January 3, 2007 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now