CmdID / PowerShell / Cmdlets / Set
Set-LocalUser
Modifies a local user account. PowerShell reference
From the PowerShell reference
12 parameters
Alias slu
What it does
Modifies a local user account. The Set-LocalUser cmdlet modifies a local user account. This cmdlet can reset the password of a local user account. NOTE: The Microsoft.PowerShell.LocalAccounts module is not available in 32-bit PowerShell on a 64-bit system.
Set-LocalUser [-AccountExpires <DateTime>] [-AccountNeverExpires] [-Description <String>] [-FullName <String>] [-Name] <String> [-Password <SecureString>] [-PasswordNeverExpires <Boolean>] [-UserMayChangePassword <Boolean>] [-WhatIf] [-Confirm] [<CommonParameters>]Set-LocalUser [-AccountExpires <DateTime>] [-AccountNeverExpires] [-Description <String>] [-FullName <String>] [-InputObject] <LocalUser> [-Password <SecureString>] [-PasswordNeverExpires <Boolean>] [-UserMayChangePassword <Boolean>] [-WhatIf] [-Confirm] [<CommonParameters>]Set-LocalUser [-AccountExpires <DateTime>] [-AccountNeverExpires] [-Description <String>] [-FullName <String>] [-Password <SecureString>] [-PasswordNeverExpires <Boolean>] [-SID] <SecurityIdentifier> [-UserMayChangePassword <Boolean>] [-WhatIf] [-Confirm] [<CommonParameters>]
Change a description of a user account
Set-LocalUser -Name "Admin07" -Description "Description of this account."IdentifyChange the password on an account
$Password = Read-Host -AsSecureString
$UserAccount = Get-LocalUser -Name "User02"
$UserAccount | Set-LocalUser -Password $PasswordIdentifyIts page in the reference: Set-LocalUser.
Parameters
-AccountExpiresSpecifies when the user account expires. To obtain a DateTime object, use the Get-Date cmdlet.
If you do not want the account to expire, specify the AccountNeverExpires parameter.-AccountNeverExpiresIndicates that the account does not expire.-DescriptionSpecifies a comment for the user account. The maximum length is 48 characters.-FullNameSpecifies the full name for the user account. The full name differs from the user name of the user account.-InputObjectSpecifies the user account that this cmdlet changes. To obtain a user account, use the
Get-LocalUser cmdlet.-NameSpecifies the name of the user account that this cmdlet changes.-PasswordSpecifies a password for the user account. If the user account is connected to a Microsoft account, do not set a password.
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, Set-LocalUser prompts you for the user's password.-PasswordNeverExpiresIndicates whether the password expires.-SIDSpecifies the security ID (SID) of the user account that this cmdlet changes.-UserMayChangePasswordIndicates that the user can 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 is not run.