开发者

Setting Active Directory Properties

I'm currnetly trying to set the four properties:

"Password never expires" "Account is disabled" "User must change password at next logon" "User cannot change password"

I can set the first two using the lines in C#:

deUser.Properties["userAccountC开发者_运维技巧ontrol"].Value = val | 0x10000; deUser.Properties["userAccountControl"].Value = val | 0x2;

though when I try to set the last two properties using the lines below they are not set.

deUser.Properties["userAccountControl"].Value = val | 0x800000; deUser.Properties["userAccountControl"].Value = val | 0x0040;

Am I setting these last two properties to the right hex value? or should I be setting something different other then "userAccountControl"?

Thanks.

Luke


You cannot modify the PASSWD_CANT_CHANGE property by setting that flag; its value is readonly. You must change it programmatically; this MSDN article describes the procedure.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜