Create admin user from command line

47

21

How would I go about making an Administrator account (read not limited) from the command line in Windows? I have seen commands to the effect of:

net user USERNAME PASSWORD /add

However it is unclear if an account created in this way would be an admin account or a limited account.

Steven Penny

Posted 2012-12-05T15:47:47.763

Reputation: 7 294

Answers

73

You are on the right track - It takes two CMD line options to do this

First -

net user /add [username] [password]

This creates the user account.

net localgroup administrators [username] /add

This adds the user to the Local Administrators Group

You have to execute both commands with elevated permissions (an administrative CMD prompt)

Chris E. Avis

Posted 2012-12-05T15:47:47.763

Reputation: 1 637

9If your windows is not in English, you will have to translate "administrators" to your local language. You can type "net localgroup" to check the list of groups and see how it is called on your computer. – personne3000 – 2014-06-22T09:53:20.257

1And what if you want to set "Password never expires" flag for the currently created user? How could you do that? – Saeed Neamati – 2014-08-12T07:34:31.623

2

Switches for net user are here: http://support.microsoft.com/kb/251394

– user36350 – 2014-12-26T17:35:47.080

@personne3000 for example: net localgroup | find /i "admin" (for latin alphabet) – Matthieu – 2019-10-23T15:55:17.257