jump to navigation

Change a domain account’s password from the command line April 8, 2008

Posted by itnsomnia in Active Directory, scripting.

For some reason my Active Directory Users and Computers MMC console refuses to start. I haven’t found the time to search for a solution to this problem yet.

That’s why I use the command line to reset domain account passwords at the moment.

Using the following command you reset user DoeJ his password to Pa$$word1!

dsquery user -samid DoeJ | dsmod user -pwd Pa$$word1!

If you use * instead of Pa$$word1!, you will be asked for a password. The new password has to adhere to the domain password policy requirements.

As you can see the command pipes the output of dsquery to dsmod.

These commands require that the Windows Server 2003 Administration Tools Pack is installed. You can find the installation file for it on any Windows Server 2003 under C:\Windows\System32\adminpak.msi

If you are logged on to a domain controller you can also use the net user command, the equivalent command in this case would be:

net user DoeJ Pa$$word1!

You can also use the net user command from your workstation:

net user DoeJ Pa$$word1! /domain

The net user command does not require that the Administration Tools Pack is installed.

More information:

dsquery on TechNet

dsmod on TechNet

net user on TechNet



1. Password News » Blog Archive » Change a domain account’s password from the command line - April 9, 2008

[…] here to read the rest: Change a domain account’s password from the command line active directory, change, change a domain, itnsomnia, office, outlook, scripting, vistaactive […]

2. rmicone1 - September 4, 2008

thanks, this is great for batch scripting the problem of CSVDE not being able to set passwords… create the users and all info, and then run the net user command on the whole list of usernames.

3. Joe - June 1, 2009

This is great for a privileged user, however….if a “mere mortal” attempts something like this, the response is “access denied.” It mostly makes sense, because in order to change a password, ordinarily one must prove authenticity by providing the old password. (Privileged users are exempt from this because of need…to force passwords when users forget them for example.) It is like net user /domain in that sense, with the domain in AD assumed to be the domain of the machine into which one has logged, IIRC.

4. Useful Commands to use with Active Directory « Ibra.Me | IT For Life - May 24, 2010

[…] edit Change a Domain Account’s Password[1] […]

5. Giri - September 9, 2011

Thanks for the post. Though I know net use command, dsquery is new to me, Also this site has many command line tips like this..check it out. http://www.windows-commandline.com

6. Anonymous - September 14, 2012

[…] […]

7. Active Directory – Change User’s Password | Learning in the Open - November 30, 2016

[…] Change a domain account’s password from the command line Link […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: