Account management

How to create a new user account with PowerShell on Windows 10

You can use the PowerShell console to create and delete new local user accounts, and this guide, you'll learn how to do this process.

Using PowerShell to create a new user account on Windows 10

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

If you’re running Windows 10, it’s likely that you’re 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’ll learn the steps to create and delete a new local user account using PowerShell on Windows 10.

How to create a new local user account with PowerShell

In order to create an administrator or standard local account on Windows 10 using PowerShell, do the following:

  1. Open Start.

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

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

    $Password = Read-Host -AsSecureString
  4. Type the password you want to use for the new account and press Enter.

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

    New-LocalUser "NEW_ACCOUNT_NAME" -Password $Password -FullName "USER_FULL_NAME" -Description "Description of this account."
    Create new user account using PowerShell
    Create new user account using PowerShell

    In the command make sure to change the account name and user full name with the settings you want. Also, update the description to anything you want.

  6. Type the following command to add the account to the correct user group and press Enter:

    Add-LocalGroupMember -Group "Administrators" -Member "NEW_ACCOUNT_NAME"
    Add new account to Administrator group
    Add new account to Administrator group

    Make sure to change the account name in the command.

    In the command we’re adding the new account to the Administrators group, which gives the user full access to the device. However, if you want the user to have limited access, you can add the account to the Users group, which makes the account a “Standard User.”

Once you’ve completed the steps, a new account will be added to your 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 just be a limited standard account.

Connecting new account to a Microsoft account

Using PowerShell should be also possible to create a user account connected to a Microsoft account, but it appears that there’s a bug with command that doesn’t allow to create this type of account.

However, a workaround this issue is to create a local account, and then connect it to a Microsoft account using the Settings app.

  1. Sign-in using the newly created user account.

  2. Open Settings.

  3. Click on Accounts.

  4. Click on Your Info.

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

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

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

How to delete a new local user account with PowerShell

If you no longer need the account, you can remove it using these steps on PowerShell:

  1. Open Start.

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

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

    Remove-LocalUser -Name "USER_ACCOUNT_NAME"
    Remove local user account using PowerShell
    Remove local user account using PowerShell

    Make sure to change the account name in the command to remove the correct account. Using the wrong name can end up deleting the incorrect account.

After completing the steps, the account will be deleted from your device. However, the user account data will remain on the hard drive. If you want to delete both, account and data, the easiest way is to delete account using the Accounts page in the Settings app.