Adding users with dsadd batch file

sdeyoungsdeyoung MemberMember Posts: 109 ■■■□□□□□□□
Can someone shed some light on this issue? I'm trying to add multiple users using a batch file created in exel. I keep getting this error message "directory object not found". This is the following syntax i'm using.

dsadd user cn=User01,ou=moncton,dc=dahouse,dc=deyoung,dc=com -upn [email protected] -display User01 -pwd Donald01 -mustchpwd yes -memberof cn=Users,ou=moncton,dc=dahouse,dc=deyoung,dc=com

I know it has something to do with the memberof section because when I remove it I don't get any errors. I just can't figure it out and it's got me pulling my hair out and it's starting to hurt :P

Any suggestions would be great..
TIA

Comments

  • sdeyoungsdeyoung Member Member Posts: 109 ■■■□□□□□□□
    Forgot to mention that it does add the users successfully but all the accounts are disabled. I need to select the account, right click and enable. When I remove the memberof section it adds the user account and it's already enabled.
  • tonydotigrtonydotigr Member Posts: 129
    A real quick suggestion would be encapsulating w/ quotations.

    "cn=User01,ou=moncton,dc=dahouse,dc=deyoung,dc=com"
  • sdeyoungsdeyoung Member Member Posts: 109 ■■■□□□□□□□
    o.k thanks. doesn't seem to fix my problem though icon_sad.gif
  • sprkymrksprkymrk Member Posts: 4,884 ■■■□□□□□□□
    Without pulling up a cmd and trying it myself, one suggestion I would have is to split your batch file into 2 parts. First the dsadd user, then a second command using dsmod to add the users to the group:

    dsmod group group_dn -addmbr member_dn
    All things are possible, only believe.
  • tonydotigrtonydotigr Member Posts: 129
    Opps.

    Try this
    -memberof ou=Users,ou=moncton,dc=dahouse,dc=deyoung,dc=com
  • sdeyoungsdeyoung Member Member Posts: 109 ■■■□□□□□□□
    tonydotigr wrote:
    Are you missing a CN=USERS here?
    cn=User01,ou=moncton,dc=dahouse,dc=deyoung,dc=com

    Is it trying to be a memberof an OU it doesn't exist in?

    I'm not sure.. I'm using a speadsheet from cbtnuggets. I just modified it with my info.. Like I said I believe it has something to do with the memberof section. As soon as a remove that it works like a charm.. It's nice in excel because you can use the autofill feature and could add hundreds of users with one batch file.. Here's the syntax from the cbtnuggets

    dsadd user cn=PhxUser01,ou=phoenix,dc=nuggetlab,dc=com -upn [email protected] -display PhxUser01 -pwd Nu66et$ -mustchpwd yes -memberof cn=phxusers,ou=phoenix,dc=nuggetlab,dc=com
  • Vogon PoetVogon Poet Member Posts: 291
    I assume you want the account enabled. You can use the -disable [yes|no] switch.
    As far as the "directory object not found," I would check to make sure my users group was in the correct OU. Also make sure it's "users" and not "user."
    No matter how paranoid you are, you're not paranoid enough.
  • sdeyoungsdeyoung Member Member Posts: 109 ■■■□□□□□□□
    Vogon Poet wrote:
    I assume you want the account enabled. You can use the -disable [yes|no] switch.
    As far as the "directory object not found," I would check to make sure my users group was in the correct OU. Also make sure it's "users" and not "user."

    You got it Vogon Poet!! That was the problem. I didn't have a group in that OU. lol.. I didn't realise that "memberof cn=Users,ou=moncton,dc=dahouse,dc=deyoung,dc=com" was refering to a group.. I'm still new to this and learning all the time.. Thanks for the help.

    BTW: the account is enabled even without the disable [yes|no] switch
  • FishoilFishoil Member Posts: 8 ■□□□□□□□□□
    OMG

    I had the same problem, phoenix OU. I spent days on this not working icon_redface.gif
    CBT nuggets are good but that video there so much going on you can miss thing as in the making of an ou at start of video of it was make in the video before the Automating User Account Management icon_wink.gif
    I'm trying, Just take me a bit longer
Sign In or Register to comment.