var data = new DirectoryEntry("LDAP://xxx.xxx", LdapAdUserName, LdapAdPassword);
data.data.Properties["LockoutThreshold"].Value = 10;`
data.data.Properties["maxPwdAge"].Value = 90;
data.CommitChanges();
I'm try to change domain password policy on AD. First, i try to update "LockoutThreshold" => OK Second, i try to update "maxPwdAge" => Exception when commit
Exception:
An exception of type 'System.DirectoryServices.DirectoryServicesCOMException' occurred in System.DirectoryServices.dll but was not handled in user code
Why can not set "maxPwdAge" ??
As i understand you need to be Domain Administrator, and maybe this will help How to get maxpwdAge attribute value in ActiveDirectory using C++?, this is on C++ but principle is the same.