This guide shows you how to create a new local user account in Windows 10 using PowerShell, a command-line tool built into the system. You’ll learn the exact commands to add a user, set a password, and optionally add the user to a group like Administrators. You need to run PowerShell as an administrator to complete these steps.
What You’ll Need
- A Windows 10 PC where you have administrator rights (you must be able to approve a User Account Control prompt).
- The username and password you want to assign to the new account.
- PowerShell (comes pre-installed with Windows 10).
Step-by-Step
- Open PowerShell as Administrator. Click the Start button, type
PowerShell, right-click Windows PowerShell in the search results, and choose Run as administrator. If prompted by User Account Control, click Yes. - Verify you have permission. In the PowerShell window, type
whoamiand press Enter. The output shows your current user. To create accounts, you need to be an administrator. If you’re unsure, typenet localgroup administratorsand check if your username is listed. - Create the user account. Use the
New-LocalUsercmdlet. The basic syntax is:New-LocalUser -Name "Username" -Password (Read-Host -AsSecureString "Enter password")
ReplaceUsernamewith the desired account name. When you press Enter, PowerShell prompts you to type a password (it won’t show characters as you type). Confirm the password when asked. This creates a local user with no password expiry by default. - Add a full name and description (optional). To make the account more identifiable, include the
-FullNameand-Descriptionparameters:New-LocalUser -Name "Username" -Password (Read-Host -AsSecureString "Enter password") -FullName "Jane Doe" -Description "Marketing team account" - Set the account to never expire. By default, Windows may apply password expiration policies. To prevent the password from expiring, use:
Set-LocalUser -Name "Username" -PasswordNeverExpires $true - Add the user to a group (optional). To grant administrator privileges, add the user to the
Administratorsgroup:Add-LocalGroupMember -Group "Administrators" -Member "Username"
For a standard user, skip this step. You can also add to other groups likeUsers(default) orRemote Desktop Users. - Verify the account was created. Type
Get-LocalUserto list all local users. Check that the new username appears. To confirm group membership, typeGet-LocalGroupMember -Group "Administrators".
Common Mistakes
- Forgetting to run as administrator. Without admin rights, PowerShell throws an “Access denied” error. Always open PowerShell with “Run as administrator”.
- Using a plaintext password in the command. Writing
-Password "MyPassword"in the command line exposes the password in your command history. UseRead-Host -AsSecureStringinstead. - Not setting a password at all. If you omit the
-Passwordparameter, the account may be created without a password, which is a security risk. Always provide a strong password. - Adding to the wrong group. Adding a user to
Administratorsgives them full control. For everyday users, keep them in theUsersgroup. - Typing the username wrong. Usernames are case-insensitive but must match exactly when you use them later. Double-check spelling.
Tips
- Use a secure password. Choose a password with at least 8 characters, including uppercase, lowercase, numbers, and symbols.
- Combine commands. You can create the user and add to a group in one line using semicolons:
New-LocalUser -Name "User" -Password (Read-Host -AsSecureString "Password") ; Add-LocalGroupMember -Group "Administrators" -Member "User" - Use a script for multiple users. If you need to create several accounts, put the commands in a .ps1 file and run it.
- Check password policy. If your organization enforces password complexity, the password you set must comply. Use
net accountsto view policy. - Set account expiry if needed. For temporary accounts, use
Set-LocalUser -Name "User" -AccountExpires (Get-Date).AddDays(30)to make it expire in 30 days.
Troubleshooting
- “Access is denied” error. This means PowerShell is not running as administrator. Close and reopen it with “Run as administrator”.
- “User already exists” error. The username is taken. Use
Get-LocalUserto see existing names, then choose a different username or remove the old one first. - Password does not meet policy. If you get “Password does not meet the complexity requirements”, choose a stronger password or adjust the policy (not recommended for security).
- Cannot find the user after creation. The account may have been created but hidden from the login screen. Press Ctrl+Alt+Delete and select “Switch user”, then type the username manually.
- PowerShell says “New-LocalUser is not recognized”. This cmdlet is available in Windows 10 version 1709 and later. If you have an older version, use the legacy command:
net user Username Password /add.
Frequently Asked Questions
Can I create a Microsoft account using PowerShell?
No, PowerShell’s New-LocalUser creates only local accounts. To add a Microsoft account, go to Settings > Accounts > Family & other users and use the GUI.
How do I create a user without a password?
You can omit the -Password parameter, but the account will have an empty password, which is insecure. Instead, create a strong password and later set it to never expire.
What is the difference between a local user and a Microsoft account?
A local user exists only on that PC, while a Microsoft account syncs settings across devices and uses an email address. PowerShell’s New-LocalUser creates local accounts only.
How do I delete a user I created?
Use Remove-LocalUser -Name "Username". Be careful: this deletes the user profile and data unless you back it up first.
Can I create a user that is a standard user by default?
Yes, by default New-LocalUser adds the user to the Users group, which is a standard user. Only add to Administrators if you explicitly want admin rights.
How do I set a password that never expires?
Use Set-LocalUser -Name "Username" -PasswordNeverExpires $true after creation.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Fix Apps Not Downloading From Play Store
- Secure a Samsung Galaxy After a Zero-Day Disclosure
- What to Check Before Installing Linux Alongside Windows
- Fix OEM Activation Error 0xc004c060 in Windows 10
- Why Does My App Run One Query for the List and One per Item?
- Fix Google Chrome Has Stopped Working