Link to home
Start Free TrialLog in
Avatar of soffcec
soffcecFlag for Iceland

asked on

Problem with dsadd user syntax in Active Directory

This is the data I need to put in

Username=Magnus
Fullname=Maggi Soffa
Address="My home address"
Password=mypasswd
DNS domain=tsc.local
Organizational Unit= "PPP Users"
Member of group="PPP Notendur"

I have tried
dsadd user cn=Magnus,"ou=PPP Users",dc=tsc,dc=local -disabled no –pwd mypasswd -mustchpwd no -memberof "cn=PPP Notendur","ou=PPP Groups",dc=tsc,dc=local -acctexpires never
Avatar of tshearon
tshearon
Flag of United States of America image

You probably just need to move those quotes to the end of your ldap path. Like this:

"ou=PPP Users,dc=tsc,dc=local"
"cn=PPP Notendur,ou=PPP Groups"

Also you can use AD powershell for this:

New-ADUser -name "Maggi Soffa" -displayname "Maggi Soffa" -SamAccountName Magnus -UserPrincipalName Magnus -GivenName "Maggi" -Surname Soffa -StreetAddress "<Your_Street_Address>" -City <Your_City> -State <Your_State> -PostalCode <Your_PostalCode> -AccountPassword (Read-Host -AsSecureString "AccountPassword") -Enabled $true -Path "ou=PPP Users,dc=tsc,dc=local"

This will prompt you for the password. Whether you use a successful password or not the account will still get created. Though if the password is not given or is not a good password per your policy then the account will be there it will just be disabled.
Avatar of soffcec

ASKER

Still getting some errors

C:\>dsadd user cn=Magnus,"ou=PPP Users,dc=tsc,dc=local" -disabled no -pwd mypass
wd -mustchpwd no -memberof "cn=PPP Notendur,ou=PPP Groups",dc=tsc,dc=local -acct
expires never
dsadd failed:'-pwd' is an unknown parameter.
type dsadd /? for help.
It could be that you have some formatting issues with your -. Retype the command in notepad, do not copy and paste from your original. The only thing I can think of is you used MSWord to type out the command and auto-format hot ahold of it and dsadd can no longer understand it.

Also, your quotes are still in the wrong place on your group membership add.

The best bet is to use powershell for this the of thing as I stated in my earlier post. Much more powerful and can be scripted a little easier.
Avatar of soffcec

ASKER

It works in PS, but I am asked for password.

PS C:\> New-ADUser -name "Maggi Soffa" -displayname "Maggi Soffa" -SamAccountNam
e Magnus -UserPrincipalName Magnus -GivenName "Maggi" -Surname Soffa -StreetAddr
ess "Hlíðarveg 8" -City Grundarfjörður -State Eyrarsveit -PostalCode 350 -Accoun
tPassword (Read-Host -AsSecureString "AccountPassword") -Enabled $true -Path "ou
=PPP Users,dc=tsc,dc=local"
AccountPassword: *******


And do you know if I can also add the static ip address for DialIn ?
ASKER CERTIFIED SOLUTION
Avatar of tshearon
tshearon
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial