Using Windows Command Line To Manage User Accounts
I’ve been doing some work on a Windows Core box and needed to modify some user accounts. As there’s no GUI the command line is the only way to go.
First up, I wanted to find which users exist in the domain. The dsquery command is used to query the Active Directory objects. Putting user at the end of it filters the object type so only user objects are returned:
To filter it down by username we can add the –name directive to filter the results
dsquery user -name Bob*
And finally I wanted to change the password on a user account. The dsmod command is used to modify Active Directory objects. After using the second command above to find the full user DN I was looking for I ran the following command:
dsmod user "CN=username,OU=Users,OU=Company,DC=Domain,DC=local" -pwd <new Password>