+ Post New Thread
Results 1 to 12 of 12
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" ...
  1. #1

    Join Date
    Oct 2005
    Location
    Wakefield, UK
    Posts
    51
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    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?

  2. #2
    Norphy's Avatar
    Join Date
    Jan 2006
    Location
    Harpenden
    Posts
    2,384
    Thank Post
    54
    Thanked 315 Times in 245 Posts
    Blog Entries
    6
    Rep Power
    120

    Re: DSADD

    I think it should be %username%, not $username$

  3. #3

    Join Date
    Oct 2005
    Location
    Wakefield, UK
    Posts
    51
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    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

  4. #4

    Join Date
    Feb 2006
    Location
    London
    Posts
    126
    Thank Post
    1
    Thanked 17 Times in 9 Posts
    Rep Power
    20

    Re: DSADD

    Quote 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$

  5. #5
    ICTNUT's Avatar
    Join Date
    Jul 2005
    Location
    Hereford
    Posts
    1,419
    Thank Post
    196
    Thanked 249 Times in 122 Posts
    Rep Power
    62

    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.

  6. #6

    Join Date
    Oct 2005
    Location
    Wakefield, UK
    Posts
    51
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    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.


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

  7. #7
    ICTNUT's Avatar
    Join Date
    Jul 2005
    Location
    Hereford
    Posts
    1,419
    Thank Post
    196
    Thanked 249 Times in 122 Posts
    Rep Power
    62

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

  8. #8

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,807
    Thank Post
    3,320
    Thanked 1,056 Times in 977 Posts
    Rep Power
    365

    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

  9. #9
    ICTNUT's Avatar
    Join Date
    Jul 2005
    Location
    Hereford
    Posts
    1,419
    Thank Post
    196
    Thanked 249 Times in 122 Posts
    Rep Power
    62

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

  10. #10

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115

    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"

  11. #11

    Join Date
    Sep 2006
    Location
    Essex
    Posts
    783
    Thank Post
    1
    Thanked 33 Times in 31 Posts
    Rep Power
    24

    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.

  12. #12
    ICTNUT's Avatar
    Join Date
    Jul 2005
    Location
    Hereford
    Posts
    1,419
    Thank Post
    196
    Thanked 249 Times in 122 Posts
    Rep Power
    62

    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:
+ Post New Thread

Similar Threads

  1. No Logon name after addding users by DSADD
    By tosca925 in forum Windows
    Replies: 8
    Last Post: 23rd May 2011, 08:31 PM
  2. quick question DSADD
    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
  •