Windows Server
This topic has not yet been rated - Rate this topic

Setting a User's Password

Updated: February 28, 2009

Applies To: Windows Server 2008 R2

This topic explains how to use the Active Directory module for Windows PowerShell to set a user’s password.

Example

The following example demonstrates how to set the password for the user account U1.

Set-ADAccountPassword –Identity U1 -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "p@ssw0rd" –Force)

Additional information

For a full explanation of the parameters that you can pass to Set-ADAccountPassword, at the Active Directory module command prompt, type Get-Help Set-ADAccountPassword –detailed.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Error if DN has "*" character

The Set-ADAccountPassword cmdlet raises an error if the distinguished name of the account includes the asterick character, "*". The error is raised even if you identify the user by sAMAccountName (astericks are not allowed in sAMAccountName values). It does not help to identify the user by distinguished name, even if you escape the "*" character, whether you escape with the backtick "`", the backslash "\", or using the 2 character ASCII hexadecimal equilvalent "\2A". The only workaround found is to bind to the account using the [ADSI] accelerator and invoke the SetPassword method.

Richard Mueller, March 14, 2012.