lastpasswordset

Setting the LastPasswordSet date for a user in Active Directory

ぐ巨炮叔叔 提交于 2019-12-08 07:18:33
问题 I want to set the LastPasswordSet attribute of a user in Microsoft Active Directory. The .NET UserPrincipal API exposes the LastPasswordSet property as readonly. Is there a way around this, to set the value (perhaps using ADSI)? Edit: MSDN provides the following example code: usr.Properties["pwdLastSet"].Value = -1; // To turn on, set this value to 0. usr.CommitChanges(); This forces the user to change their password at next logon. I presume if I replace -1 with a date-time in the relevant