How to create new account with PowerShell on Windows 10

You can use PowerShell to create and delete new local user accounts on Windows 10, and this guide, you'll learn how to perform this task.

PowerShell create Windows 10 local account
PowerShell create Windows 10 local account

On Windows 10, you can create a local user account or Microsoft account that allows you 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’re likely already utilizing an account connected to a Microsoft account. However, if you have to set up another account (in addition to 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 new local user account from PowerShell

To create a standard or administrator local account with PowerShell, use these steps:

  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

    In the command, 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

    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 it a “Standard User.”

Once you complete the steps, the new account will be set up on 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.

Connect account to Microsoft

Using PowerShell should also be possible to create a user account connected to a Microsoft account with this command: New-LocalUser -Name "MicrosoftAccount\[email protected]" -Description "Microsoft account description". However, a bug still returns “New-LocalUser: Cannot validate argument on parameter ‘Name.’ The character length of the 36 arguments 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” message. 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” option.

  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 from PowerShell

To delete an account with PowerShell on Windows 10, use these steps:

  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

    In the command, 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 to delete it is using the “Accounts” page from the Settings app.

About the author

Mauro Huculak is a Windows How-To Expert who started Pureinfotech in 2010 as an independent online publication. He has also been a Windows Central contributor for nearly a decade. Mauro has over 15 years of experience writing comprehensive guides and creating professional videos about Windows and software, including Android and Linux. Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 21 years of combined experience in technology. Throughout his career, he achieved different professional certifications from Microsoft (MSCA), Cisco (CCNP), VMware (VCP), and CompTIA (A+ and Network+), and he has been recognized as a Microsoft MVP for many years. You can follow him on X (Twitter), YouTube, LinkedIn and About.me. Email him at [email protected].