Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 435
  • Last Modified:

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
0
soffcec
Asked:
soffcec
  • 3
  • 2
1 Solution
 
tshearonCommented:
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.
0
 
soffcecAuthor Commented:
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.
0
 
tshearonCommented:
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.
0
 
soffcecAuthor Commented:
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 ?
0
 
tshearonCommented:
You can use the script I have attached to pass the password directly as a text string. This is not secure as you are now typing out your password in plain text but since you were doing that anyway I am not sure it matters. Rename the script from *.txt to *.ps1 and then open AD powershell and execute the script in the directory you copied it into by running ./createuser.ps1.

As far as whether you can add a dialin ip to the AD account, I am not aware of any such attribute that exists. Do you mean another attribute possibly like IP Phone number maybe?
createuser.txt
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now