大网数据广告活动
域与目录服务

Set a user's password with Ldifde

· 52CE 我爱测

Describes how to set a user's password by using the Ldifde tool.

This article describes how to set a user's password by using the Ldifde tool.

Original KB number:   263991

More information

The password attribute used by Active Directory is "unicodePwd". This attribute can be written under restricted conditions, but cannot be read. This attribute can only be modified, not added on object creation or read by a search.

To modify this attribute, the client must have a 128-bit Secure Sockets Layer/Transport Layer Security(SSL/TLS) or SASL encrypted connection to the server. The High Encryption pack must be installed on both the client and the server.

Note: When you want to use SASL encryption, you can use the "/h" argument of LDIFDE.
When you use a base-64 encoder, you must make sure that it supports Unicode, or you will create an incorrect password.

There are two ways to modify the unicodePwd attribute. The first is analogous to a typical user change-password operation. In this case, the modify request must contain both a delete operation and an add operation. The delete operation must contain the current password enclosed in quotation marks and be Base64 encoded as described in RFC 1521. The add operation must contain the new password enclosed in quotation marks and be Base64 encoded.

The second way to modify the attribute is analogous to an administrator resetting a password for a user. To do this, the client must have bound as an administrator a user who has sufficient rights to modify other users' passwords. The modify request should contain a single replace operation with the new password enclosed in quotation marks and be Base64 encoded. If the client has sufficient rights, this password becomes the new password regardless of what the old password was.

The following sample Ldif file (chPwd.ldif) changes a password to newPassword:

dn: CN=TestUser,DC=testdomain,DC=com
changetype: modify
replace: unicodePwd
unicodePwd::IgBuAGUAdwBQAGEAcwBzAHcAbwByAGQAIgA=
-

To import the chPwd.ldif file, use the following command:

  • SSL/TLS:
    ldifde -i -f chPwd.ldif -t 636 -s \<dcname> -b \<username> \<domain> \<password>
  • SASL:
    ldifde -i -f chPwd.ldif -h -s \<dcname> -b \<username> \<domain> \<password>

If the password does not fulfill the criteria of the enforced Password Policies, then it will throw an error:

Add error on entry starting on line 1: Unwilling To Perform The server-side error is "A device attached to the system is not functioning

For more information, see the following documents:

RFC 1521 on the following IETF Web site:
RFC 1521

Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
- Supported versions of Windows Server · Source date 02/12/2026
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。