CmdID

CmdID / PowerShell / Cmdlets / New

New-LocalUser

Creates a local user account. PowerShell reference

From the PowerShell reference 12 parameters Alias nlu

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

Creates a local user account. The New-LocalUser cmdlet creates a local user account. This cmdlet creates a local user account. NOTE: The Microsoft.PowerShell.LocalAccounts module isn't available in 32-bit PowerShell on a 64-bit system.

New-LocalUser [-AccountExpires <DateTime>] [-AccountNeverExpires] [-Description <String>] [-Disabled] [-FullName <String>] [-Name] <String> -Password <SecureString> [-PasswordNeverExpires] [-UserMayNotChangePassword] [-WhatIf] [-Confirm] [<CommonParameters>]
New-LocalUser [-AccountExpires <DateTime>] [-AccountNeverExpires] [-Description <String>] [-Disabled] [-FullName <String>] [-Name] <String> [-NoPassword] [-UserMayNotChangePassword] [-WhatIf] [-Confirm] [<CommonParameters>]

Create a user account

New-LocalUser -Name 'User02' -Description 'Description of this account.' -NoPasswordIdentify

Create a user account that has a password

$Password = Read-Host -AsSecureString $params = @{ Name = 'User03' Password = $Password FullName = 'Third User' Description = 'Description of this account.' } New-LocalUser @paramsIdentify

Its page in the reference: New-LocalUser.

Parameters

12 in the PowerShell reference
-AccountExpiresSpecifies when the user account expires. You can use the Get-Date cmdlet to get a DateTime object. If you don't specify this parameter, the account doesn't expire.
-AccountNeverExpiresIndicates that the account doesn't expire.
-DescriptionSpecifies a comment for the user account. The maximum length is 48 characters.
-DisabledIndicates that this cmdlet creates the user account as disabled.
-FullNameSpecifies the full name for the user account. The full name differs from the user name of the user account.
-NameSpecifies the user name for the user account. A user name can contain up to 20 uppercase characters or lowercase characters. A user name can't contain the following characters: ", /, \, [, ], :, ;, |, =, ,, +, *, ?, <, >, @ A user name can't consist only of periods . or spaces.
-NoPasswordIndicates that the user account doesn't have a password.
-PasswordSpecifies a password for the user account. You can use Read-Host -AsSecureString, Get-Credential, or ConvertTo-SecureString to create a SecureString object for the password. If you omit the Password and NoPassword parameters, New-LocalUser prompts you for the new user's password.
-PasswordNeverExpiresIndicates whether the new user's password expires.
-UserMayNotChangePasswordIndicates that the user can't change the password on the user account.
-ConfirmPrompts you for confirmation before running the cmdlet.
-WhatIfShows what would happen if the cmdlet runs. The cmdlet isn't run.