CmdID / PowerShell / Cmdlets / Rename
Rename-LocalUser
Renames a local user account. PowerShell reference
From the PowerShell reference
6 parameters
Alias rnlu
What it does
Renames a local user account. The Rename-LocalUser cmdlet renames a local user account. NOTE: The Microsoft.PowerShell.LocalAccounts module is not available in 32-bit PowerShell on a 64-bit system.
Rename-LocalUser [-InputObject] <LocalUser> [-NewName] <String> [-WhatIf] [-Confirm] [<CommonParameters>]Rename-LocalUser [-Name] <String> [-NewName] <String> [-WhatIf] [-Confirm] [<CommonParameters>]Rename-LocalUser [-NewName] <String> [-SID] <SecurityIdentifier> [-WhatIf] [-Confirm] [<CommonParameters>]
Rename a user account
Rename-LocalUser -Name "Admin02" -NewName "AdminContoso02"IdentifyIts page in the reference: Rename-LocalUser.
Parameters
-InputObjectSpecifies the user account that this cmdlet renames. To obtain a user account, use the Get-LocalUser cmdlet.-NameSpecifies the name of the user account that this cmdlet renames.-NewNameSpecifies a new name for the user account.-SIDSpecifies the security ID (SID) of a user accounts that this cmdlet renames.-ConfirmPrompts you for confirmation before running the cmdlet.-WhatIfShows what would happen if the cmdlet runs. The cmdlet is not run.