Windows 10 allows you to create a new user account where you can get additional benefits like effortless integration to different Microsoft cloud services, syncing across devices, and others. In order to get these benefits, you need to set up a new user account.
The good thing is that you can create a new users account With PowerShell on Windows 10. Here in this article, we will show you the way to create a new user account with PowerShell on Windows 10.
Create a new user account with PowerShell on Windows 10
In order to create a new user account, create a local account first and then connect it with Microsoft account. Follow the below instructions to set up a new user account using PowerShell.
- Right-click on the Windows icon and choose Windows PowerShell (Admin) from the menu.
- Confirm Yes when UAC prompts.
- In the PowerShell window, type the command given below to temporarily store the password inside the $Password variable and hit Enter.
$Password = Read-Host -AsSecureString
- Now type the password you want and hit Enter.
- In the elevated window, type the command given below to create the new account and hit enter.
New-LocalUser "NEW_ACCOUNT_NAME" -Password $Password -FullName "USER_FULL_NAME" -Description "Description of this account."
Note: Substitute the NEW_ACCOUNT_NAME with the user name and USER_FULL_NAME with the full user name.
- Type the command given below to create an Administrator account and Hit Enter.
Add-LocalGroupMember -Group "Administrators" -Member "NEW_ACCOUNT_NAME"
Note: Substitute the NEW_ACCOUNT_NAME with the user’s name. This command is for creating an Administrator account. It allows the new user to have full access to the device. In the case when you want to provide limited access to the new users, substitute the Administrators group with the Users group. This will create Local user accounts.
Connect your newly created account to a Microsoft account
Now that you have created a new user account using PowerShell, you may add a Microsoft account to it as well. We strongly suggest doing this because you can never retrieve back the lost data when you suddenly forget the local user account passkey.
However, even if you forget your passkey when connected through a Microsoft, you can readily reset your password by clicking on – “I forgot my password“.
Follow the below instructions on how to connect your Microsoft account to the newly created user profile on your Windows PC.
- Press Windows + I to launch Settings.
- Go to Accounts, and click Your info on the right pane.
- Here, you can see the Sign in with your Microsoft account instead option.
Well, click on this link and do as you asked while the system is adding your Microsoft account to this PC. After this is over, you will see your previous account linked to a Microsoft account.
How to delete a new local user account with Powershell
Assuming you did create a new user account, there’s no use for your previous user profile. You may either delete your old profiles or keep them as long as you want. The below instructions will guide you on how to delete a new user or an existing user account from your Windows PC.
- Press Win + X, and select Windows PowerShell (Admin).
Note: Several users change this default configuration and add Command Prompt in place of PowerShell. If you have changed it as well, you may bring back the PowerShell from the taskbar settings under Personalization.
- The UAC window might prompt next, hit yes to authorize opening Windows PowerShell.
- When the PowerShell opens up, type the command given below and press Enter.
Remove-LocalUser -Name "USER_ACCOUNT_NAME"
Note: Don’t forget to substitute the USER_ACCOUNT_NAME with the new account name. In the case when you use the wrong name, the system will delete the incorrect account.
Once you complete the above steps, the new user account will be deleted from your system.