Solved

Problem with dsadd user syntax in Active Directory

Posted on 2014-11-19
5
350 Views
Last Modified: 2014-12-15
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
Comment
Question by:soffcec
  • 3
  • 2
5 Comments
 
LVL 8

Expert Comment

by:tshearon
ID: 40452994
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
 

Author Comment

by:soffcec
ID: 40454041
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
 
LVL 8

Expert Comment

by:tshearon
ID: 40454883
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
 

Author Comment

by:soffcec
ID: 40455023
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
 
LVL 8

Accepted Solution

by:
tshearon earned 500 total points
ID: 40455381
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Synchronize a new Active Directory domain with an existing Office 365 tenant
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
In this Micro Tutorial viewers will learn how to use Windows Server Backup to create full image of their system. Tutorial shows how to install Windows Server Backup Feature on Windows 2012R2 and how to configure scheduled Bare Metal Recovery backup.…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question