In c# how does one set the value of the AD property "pwdLastSet"
This is not working:
DateTime passwordLastSetTarg = System.DateTime.Now.AddHours( -25 );
var adDate = userToActOn.ADEntry.Properties[ "pwdLastSet" ].Value;
long filetime = passwordLastSetTarg.ToFileTimeUtc();
userToActOn.ADEntry.Properties开发者_运维百科[ "pwdLastSet" ][ 0 ] = filetime;
This is closely related to my last question, but I hope it's not redundant, if so sorry.
You can't set it to a date - only to 0 (expires now) or -1 (reset the time to 'now' )
Unless I'm misreading the MSDN docs, this is a read-only property - as I'd have expected it would be. It's up to AD to set this as and when a user changes their password.
精彩评论