Step 1: Open Command Prompt as Administrator
To execute the following commands, you need elevated privileges. Open the Command Prompt with admin rights by:
- Press
Win + R
, type cmd, and pressCtrl + Shift + Enter
. - Click Yes if prompted by User Account Control (UAC).
Step 2: Create a New User
To add a new user, use the following command:
net user username password /add
- Replace
username
with the desired username. - Replace
password
with a strong password for the account.
For example, to create a user named JohnDoe with the password SecurePass123, run:
net user JohnDoe SecurePass123 /add
Step 3: Add the User to the Local Administrators Group
After creating the user, you can grant them administrator privileges by adding them to the Administrators group:
net localgroup Administrators username /add
For instance, to make JohnDoe an administrator:
net localgroup Administrators JohnDoe /add
Verifying the Changes
To confirm that the user has been successfully added to the Administrators group, use:
net localgroup Administrators
This will display all users who have administrative privileges on the system.
Removing a User (Optional)
If you need to remove a user account, you can use:
net user username /delete
For example, to delete JohnDoe:
net user JohnDoe /delete