On Windows 10, you can create a local user account or a Microsoft account that allows you to enjoy additional benefits, such as synchronization of settings between devices and seamless integration with various Microsoft cloud services.
If you’re using Windows 10, you’re probably already using an account connected to a Microsoft account. However, if you need to set up another account (besides using the Settings app and Command Prompt), you can create a new local user account from PowerShell.
This guide will teach you the steps to create and delete a new local user account using PowerShell on Windows 10.
Create a new local user account from PowerShell
To create a local standard or administrator account with PowerShell, follow these steps:
1. Open To start up on Windows 10.
2. Research PowerShellright-click on the first result and select the option Execute as administrator.
3. Type the following command to temporarily store the password in a secure string inside the “$Password” variable and press Hall :
$Password = Read-Host -AsSecureString
4. Type the password for the new Windows 10 account and press Hall.
5. Type the following command to create the new account with PowerShell and press Hall :
New-LocalUser "NOUVEAU NOM DE COMPTE" -Password $Password -FullName "NOM COMPLET DE L'UTILISATEUR" -Description "DESCRIPTION"
In the command, change NEW ACCOUNT NAME for the account name and FULL USER NAME for the user’s full name. Also replace DESCRIPTION with the description you want to use for the account.
6. Type the following command to add the Windows 10 account to the correct user group and press Hall :
Add-LocalGroupMember -Group "Administrators" -Member "NOUVEAU NOM DE COMPTE"
In the command, be sure to change NEW ACCOUNT NAME for the account name. In the above command we add the new account to the group Administrators, which gives the user full access to the computer. However, if you want the user to have limited access, you can add the account to the group Usersmaking it a “Standard User”.
Once the steps are completed, the new account will be set up on the device with full access using administrative privileges. Of course, unless you’ve added the account to the “Users” group, in which case the account will be a limited standard account.
Connect account to Microsoft
Using PowerShell should also create a user account connected to a Microsoft account with this command:
New-LocalUser -Name "MicrosoftAccount[email protected]" -Description "Description du compte Microsoft". However, a bug still returns “New-LocalUser: Failed to validate argument on parameter ‘Name.’ The character length of the 36 arguments is too long. Shorten the number of characters in the argument so that it is less than or equal to “20” characters, then try the command again”. Therefore, the easiest way to work around this problem is to create a local account and then use the Settings app to link it to a Microsoft account.
To associate a local account with a Microsoft account, follow these steps:
1. Open Settings.
2. Click Accounts.
3. Click Your informations.
4. Click on the option Sign in with your Microsoft account instead.
5. Continue with the onscreen instructions to connect your account to a Microsoft account.
Delete the new local user account with PowerShell
To delete an account with PowerShell in Windows 10, follow these steps:
1. Open To start up.
2. Research Windows PowerShellright-click on the first result and select the option Execute as administrator.
3. Type the following command to delete the user account and press Hall :
Remove-LocalUser -Name "NOM DU COMPTE UTILISATEUR"
In the command, replace USER ACCOUNT NAME by the name of the account you want to delete.
Once the steps are completed, the account will be removed from the computer. However, the user account data will remain. If you want to delete both the account and the data, the easiest way to delete it is to use the “Accounts” page in the Settings app.
If you have any questions or suggestions, let us know in the comments. Also check out this guide if you want to learn how to create a local account on Windows 11.
Leave a Reply