Change a domain account’s password from the command line April 8, 2008Posted 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.
dsquery on TechNet
dsmod on TechNet
net user on TechNet