60

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.

1 Answer 1

95

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)

7
  • 11
    If 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. Commented Jun 22, 2014 at 9:53
  • 2
    And what if you want to set "Password never expires" flag for the currently created user? How could you do that? Commented Aug 12, 2014 at 7:34
  • 3
    Switches for net user are here: support.microsoft.com/kb/251394
    – user36350
    Commented Dec 26, 2014 at 17:35
  • @personne3000 for example: net localgroup | find /i "admin" (for latin alphabet)
    – Matthieu
    Commented Oct 23, 2019 at 15:55
  • 1
    @SaeedNeamati to disable password expiry, it looks like you need to use wmic: wmic useraccount where "Name='MyUser' and LocalAccount=true" set PasswordExpires=false
    – mwfearnley
    Commented Jan 10 at 17:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .