Adding users with dsadd batch file
sdeyoung
Member 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 User01@deyoung.com -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
dsadd user cn=User01,ou=moncton,dc=dahouse,dc=deyoung,dc=com -upn User01@deyoung.com -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
-
sdeyoung 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.
-
tonydotigr Member Posts: 129A real quick suggestion would be encapsulating w/ quotations.
"cn=User01,ou=moncton,dc=dahouse,dc=deyoung,dc=com" -
sprkymrk 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_dnAll things are possible, only believe. -
tonydotigr Member Posts: 129Opps.
Try this-memberof ou=Users,ou=moncton,dc=dahouse,dc=deyoung,dc=com -
sdeyoung 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 PhxUser01@nuggetlab.com -display PhxUser01 -pwd Nu66et$ -mustchpwd yes -memberof cn=phxusers,ou=phoenix,dc=nuggetlab,dc=com -
Vogon Poet Member Posts: 291I 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. -
sdeyoung 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 -
Fishoil Member Posts: 8 ■□□□□□□□□□OMG
I had the same problem, phoenix OU. I spent days on this not working
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 ManagementI'm trying, Just take me a bit longer