To give a user local administrator rights via the command line, use the command net localgroup administrators "username" /add in an elevated Command Prompt. This action adds the specified user account to the local Administrators group, granting them full permission to install software, modify system settings, and manage other user accounts on that specific machine.
Granting administrative privileges is a powerful action. Standard user accounts are restricted to prevent accidental system changes or the installation of malicious software. By promoting a user to an administrator, you remove these safeguards for that account. Ensure the user is trusted and understands the responsibility of managing system-level permissions.
What You'll Need
- A computer running a version of Windows.
- An existing account on the machine that already has administrator privileges (required to authorize the change).
- The exact username of the account you wish to promote.
Step-by-Step
- Find the target username: If you are unsure of the exact username, open a Command Prompt and type
net user. This will list all user accounts currently registered on the local machine. Note the exact spelling of the account you want to change. - Open an elevated Command Prompt: You cannot grant admin rights from a standard user session. Click the Start menu, type "cmd", right-click on Command Prompt, and select Run as administrator. If prompted by User Account Control (UAC), click Yes.
- Enter the promotion command: In the black window, type the following command, replacing
usernamewith the actual name of the user:net localgroup administrators "username" /add
Note: If the username contains spaces, the quotation marks are mandatory. - Execute the command: Press Enter. If successful, the system will display the message: "The command completed successfully."
- Verify the change: To confirm the user is now part of the administrators group, type:
net localgroup administrators
Press Enter and look for the username in the list of members. - Apply the changes: The user must sign out of their current Windows session and sign back in for the new administrative permissions to take effect.
Common Mistakes
- Running CMD as a standard user: The most common error is failing to "Run as administrator." If you see "System error 5 has occurred. Access is denied," it means the Command Prompt does not have the necessary permissions to modify group memberships.
- Typing the username incorrectly: Command line tools are literal. A misspelling or a missing quotation mark for a name with spaces will result in "The user name could not be found."
- Confusing Usernames with Display Names: The "Full Name" seen on the login screen is sometimes different from the actual "Username" used by the system. Always use the
net usercommand to verify the system name. - Assuming immediate effect: Many users attempt to run an installer immediately after the command. The user must log out and log back in to refresh their security token.
Tips
- Use quotes for safety: Even if the username doesn't have spaces, using quotation marks (e.g.,
"John") is a good habit that prevents syntax errors. - Removing rights: If you need to revoke administrative privileges later, use the same process but replace
/addwith/delete:net localgroup administrators "username" /delete. - Check for Domain accounts: If the computer is part of a corporate domain, you may need to specify the domain in the command or use Active Directory tools, as local group commands may behave differently depending on Group Policy settings.
Troubleshooting
If the process does not go as planned, try these steps in order:
- Check for "Access Denied": If you receive a permission error, double-check the title bar of your Command Prompt window. It must say "Administrator: Command Prompt." If it only says "Command Prompt," close it and use the right-click "Run as administrator" method.
- Verify User Existence: If the system says the user cannot be found, run
net useragain. Ensure you are not using the account's email address (for Microsoft accounts); use the local folder name found inC:\Usersif you are unsure. - Restart the machine: In rare cases, the local security database may not update immediately. A full system restart can force the group membership to refresh.
- Check for Group Policy Overrides: In a work or school environment, a Domain Controller may have a "Restricted Groups" policy. This policy automatically removes users from the local admin group every few minutes. If the user is added but then disappears, contact your network administrator.
Frequently Asked Questions
Can I do this without knowing the current admin password?
No. To run an elevated Command Prompt, you must provide the credentials of an existing administrator. This is a security feature to prevent unauthorized users from gaining full control of the system.
Will this delete the user's files?
No. Adding a user to the Administrators group only changes their permission level. It does not affect their files, settings, or installed applications.
What is the difference between a Standard user and an Administrator?
Standard users can run apps and change settings that only affect their own profile. Administrators can change system-wide settings, install software for all users, and access all files on the hard drive.
Does this work on Windows 10 and Windows 11?
Yes, the net localgroup command is a legacy tool that remains functional across Windows 10 and Windows 11.
Can I use PowerShell instead of Command Prompt?
Yes, the net localgroup command works in PowerShell. However, you must still launch PowerShell as an Administrator for the command to work.