Windows Command to Give Users Admin Rights
In this article
The fastest way to give a user admin rights from the Windows command line is to add their account to the local Administrators group. Run Command Prompt as administrator, then type net localgroup administrators <username> /add and press Enter. Replace <username> with the exact account name. The change takes effect the next time that user signs in. This works on Windows 10 and 11 Pro, Enterprise, and Education; on Windows Home the built-in Administrator account is disabled by default, but the same command still adds a standard user to the Administrators group. You need an account that is already an administrator and the ability to open an elevated command prompt.
What You'll Need
- A Windows PC where you are signed in with an account that already has administrator rights.
- The exact username of the account you want to promote. You can find it in Settings > Accounts > Other users or by running
net userin Command Prompt. - Command Prompt opened as administrator. Right-click Start, choose Terminal (Admin) or Command Prompt (Admin), and approve the User Account Control prompt.
Step-by-Step
- Open an elevated command prompt. Right-click the Start button and select Terminal (Admin) on Windows 11 or Command Prompt (Admin) on Windows 10. If you only see the normal Terminal or Command Prompt, search for it in the Start menu, right-click the result, and choose Run as administrator. Click Yes on the User Account Control prompt. The window title should say Administrator.
- Confirm the exact username. Type
net userand press Enter. This lists all local accounts. Note the spelling exactly, including spaces. If the account is a Microsoft account, the username is usually the first five letters of the email address before the @ symbol, but it can differ. You can also check Settings > Accounts > Other users, where the name is shown under the account picture. - Add the user to the Administrators group. Type
net localgroup administrators <username> /addand press Enter. For example, to promote a user named Alex, typenet localgroup administrators Alex /add. If the username contains a space, put it in quotation marks:net localgroup administrators "Alex Smith" /add. You should see the message The command completed successfully. - Verify the change. Type
net localgroup administratorsand press Enter. The account you added should appear in the list below the separator line. If it does not, repeat step 3 and check the spelling. - Have the user sign out and back in. Group membership is applied at sign-in. The user will not see administrator rights until they sign out of Windows and sign back in, or restart the PC. After signing in, they can open an elevated command prompt or run apps as administrator.
Labels in Settings and the right-click menu can differ slightly between Windows versions and editions. On Windows 11 the elevated shell is Windows Terminal by default; on Windows 10 it is usually Command Prompt. The net localgroup command works the same on both.
Common Mistakes
- Running the command in a normal prompt. Without elevation you will get Access is denied or System error 5 has occurred. Always open the shell as administrator.
- Using the display name instead of the username. The name shown on the sign-in screen is not always the account name. Run
net userto get the real one. - Forgetting quotation marks for names with spaces. The command will treat each word as a separate argument and fail.
- Expecting the change to apply immediately. The user must sign out and back in. Some background processes may need a restart as well.
- Adding the account to the wrong group. The group name is administrators (plural). Using administrator refers to the built-in account, not the group.
Tips
- Use
net localgroup administrators <username> /deleteto remove admin rights later. The user keeps their standard account and files. - For a Microsoft account, the username in
net usermay look like alexsmith or a truncated email prefix. If you are unsure, add the account through Settings > Accounts > Other users > Change account type instead, which uses the same underlying group membership. - You can also use PowerShell with
Add-LocalGroupMember -Group "Administrators" -Member "<username>"if you prefer. It requires an elevated PowerShell window. - Keep at least one known administrator account on the PC. If you remove admin rights from every account, you may need to use the built-in Administrator account or recovery options to regain control.
- On domain-joined PCs, local group changes may be overridden by Group Policy. Check with your IT administrator before making changes.
Troubleshooting
If you see "Access is denied" or "System error 5": the command prompt is not elevated. Close it and reopen with Run as administrator.
If you see "The specified local group does not exist": the group name is misspelled or you are on a domain controller where local groups behave differently. On a standard PC, use administrators exactly.
If you see "The user name could not be found": run net user to list accounts and copy the name exactly. For Microsoft accounts, try the name shown in Settings > Accounts > Other users.
If the user still cannot run admin tasks after signing out and in: check that the account appears in net localgroup administrators. If it does, the app may be requesting credentials for a different account, or Group Policy may be restricting admin rights. Restart the PC and try again.
If you are locked out because no account has admin rights: boot into Safe Mode or use Windows Recovery Environment to access the built-in Administrator account, then repeat the steps. This requires physical access to the PC.
Frequently Asked Questions
Can I give admin rights to a standard user without signing in as an administrator?
No. You need an account that already has administrator rights to open an elevated command prompt and run the command.
Does this work on Windows Home?
Yes. The net localgroup administrators command works on Windows Home editions as well, provided you run it from an elevated prompt.
Will the user lose their files or settings?
No. Adding an account to the Administrators group does not change the user profile, files, or installed apps. It only changes permissions.
How do I remove admin rights later?
Run net localgroup administrators <username> /delete from an elevated prompt, then have the user sign out and back in.
Can I add a Microsoft account this way?
Yes, if you use the correct local username. If the command cannot find the account, use Settings > Accounts > Other users > Change account type instead.
Why does the command say "The command completed successfully" but the user is not an admin?
The change is applied at the next sign-in. Have the user sign out and back in, or restart the PC.