How to create new account with PowerShell on Windows 10

On Windows 10, you can create a local user account or an account connected to a Microsoft account to take advantage of additional benefits, such as settings syncing across devices and seamless integration to various Microsoft cloud services.

If you use Windows 10, you are likely already using an account connected to a Microsoft account. However, in the case that you need to set up another account (in addition to using the Settings app and Command Prompt), you can create a new local user account using PowerShell.

In this guide, you will learn the steps to create and delete a new local user account using PowerShell on Windows 10.

Create new local user account with PowerShell

Use the following steps to create a standard or administrator local account with PowerShell:

  1. Open Start on Windows 10.

  2. Search for PowerShell, right-click the top result, and select the Run as administrator option.

  3. Type the following command to temporarily store the password in a secure string inside the “$Password” variable and press Enter:

    $Password = Read-Host -AsSecureString
  4. Type the password for the new Windows 10 account and press Enter.

  5. Type the following command to create the new account with PowerShell and press Enter:

    New-LocalUser "NEW_ACCOUNT_NAME" -Password $Password -FullName "USER_FULL_NAME" -Description "DESCRIPTION"
    PowerShell create local account
    PowerShell create local account

    In the command, make sure to change NEW_ACCOUNT_NAME for the account name and USER_FULL_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 Enter:

    Add-LocalGroupMember -Group "Administrators" -Member "NEW_ACCOUNT_NAME"
    PowerShell change account type
    PowerShell change account type

    In the command, make sure to change NEW_ACCOUNT_NAME for the account name. In the above command, we add the new account to the Administrators group, 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 Users group, making the account a “Standard User.”

Once you complete the steps, the new account will be added to the device with full access using administrative privileges. Of course, this is unless you added the account to the “Users” group, in which case the account will be a limited standard account.

.Windows_Software_Technology-Big-343{display:inline-block;width:300px;height:600px}@media(min-width: 500px){.Windows_Software_Technology-Big-343{width:300px;height:600px}}

Connect new account to a Microsoft account

Using PowerShell should also be possible to create a user account connected to a Microsoft account with this command: New-LocalUser -Name "MicrosoftAccount\accounName@outlook.com" -Description "Microsoft account description". However, there is still a bug that returns this message when running the command: “New-LocalUser: Cannot validate argument on parameter ‘Name’. The character length of the 36 argument is too long. Shorten the character length of the argument so it is fewer than or equal to “20” characters, and then try the command again.” As a result, the easiest way to get around this problem is to create a local account and then use the Settings app to link it with a Microsoft account.

To link a local account with a Microsoft account, use these steps:

  1. Open Settings.

  2. Click on Accounts.

  3. Click on Your Info.

  4. Click the Sign in with your Microsoft account instead link.

  5. Continue with the on-screen directions to connect your account to a Microsoft account.

After you complete the steps, the new account will be connected to the Microsoft account you specified.

Delete new local user account with PowerShell

Use the following steps to delete an account with PowerShell on Windows 10:

  1. Open Start.

  2. Search for Windows PowerShell, right-click the top result, and select the Run as administrator option.

  3. Type the following command to delete the user account and press Enter:

    Remove-LocalUser -Name "USER_ACCOUNT_NAME"
    PowerShell delete account
    PowerShell delete account

    In the command, make sure to change USER_ACCOUNT_NAME with the account name you want to remove.

After you complete the steps, the account will be deleted from the computer. However, the user account data will remain. If you want to delete both, account and data, the easiest way is to delete the account using the “Accounts” page from the Settings app.

.Windows_Software_Technology_ResLinks-343{display:inline-block;width:320px;height:50px}@media(min-width: 500px){.Windows_Software_Technology_ResLinks-343{width:200px;height:90px}}

Post a Comment