While Microsoft often pushes users towards cloud-based accounts, there are still situations where creating local accounts on your Windows machine is necessary. This could be for managing remote endpoints, maintaining a specific security posture, or simply personal preference.
This blog post will guide you through creating a local user account with administrator privileges using the command line in Windows 11.
Why Use the Command Line?
There are several reasons why you might choose to create a user via the command line:
- Efficiency: For experienced users, the command line can be a faster way to create multiple accounts.
- Remote Management: If you’re managing multiple machines remotely, scripting user creation through the command line can be a real time-saver.
- Customization: The command line offers more granular control over user creation compared to the graphical interface.
Prerequisites:
- An administrator account on the Windows 11 machine.
- Basic understanding of command prompt navigation.
Creating the User Account
- Open an elevated command prompt.
- Search for “cmd” in the Start menu, right-click on “Command Prompt,” and select “Run as administrator.”
- Click “Yes” if prompted by User Account Control (UAC).
- Create the user account. Use the following command, replacing USERNAME with your desired username and PASSWORD with a strong password (enclose the password in quotations if it contains spaces):
net user USERNAME PASSWORD /add
- Press Enter. A success message will indicate that the user account has been created.
Granting Administrator Privileges
By default, newly created user accounts are standard accounts. To grant administrator privileges to the new user, use the following command:
net localgroup administrators USERNAME /add
Replace USERNAME with the username you just created. Press Enter. Again, a success message will confirm that the user has been added to the Administrators group.
Disable / deactivate a user
Use the following command, replacing USERNAME
with the name of the account you want to disable:
net user USERNAME /active:no
Replace USERNAME with the username you want to deactivate.
Activate a user
Similarly use the following command, replacing USERNAME
with the name of the account you want to activate:
net user USERNAME /active:yes
Replace USERNAME with the username you want to activate.
—
Tested for Windows 11/Microsoft Windows [Version 10.0.22631.3235]