开发者

In c# how does one set the value of the AD property "pwdLastSet"

开发者 https://www.devze.com 2023-03-01 04:30 出处:网络
In c# how does one set the value of the AD property \"pwdLastSet\" This is not working: DateTime passwordLastSetTarg= System.DateTime.Now.AddHours( -25 );

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消