Solved

Problem with dsadd user syntax in Active Directory

Posted on 2014-11-19
5
340 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Resolve DNS query failed errors for Exchange
In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

815 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now