views:

84

answers:

2

Hi,

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["userAccountControl"].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

A: 

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.

Michael Petrotta
A: 

Consider this link: ADS_USER_FLAG_ENUM Enumeration.

Rubens Farias