M
Michael Howes
I have some code that manages local user logins.
When I create a new user I want to set the password to expire every x
days and the number of failed login attempts before the account is
disable/locked out. I can't seem to figure out how.
I saw two properties in MSDN BadPasswordAttempts and MaxPasswordAge
but I can't seem to set them on the new user.
my code looks like this
DirectoryEntry newUser = null; ;
newUser = m_DomainMachine.Children.Add(Username, "user");
newUser.Invoke("SetPassword", new object[] { Pswd });
newUser.Properties["Description"].Value = Description;
newUser.Properties["FullName"].Value = Fullname;
newUser.Properties["BadPasswordAttempts"].Value = 3;
newUser.Properties["MaxPasswordAge"].Value = 90;
I get an exception when I try and set those two properties that those
properties aren't in the property cache.
Is there a way to set properties like these on a new user or does this
have to do with the local policies
thanks
mike
When I create a new user I want to set the password to expire every x
days and the number of failed login attempts before the account is
disable/locked out. I can't seem to figure out how.
I saw two properties in MSDN BadPasswordAttempts and MaxPasswordAge
but I can't seem to set them on the new user.
my code looks like this
DirectoryEntry newUser = null; ;
newUser = m_DomainMachine.Children.Add(Username, "user");
newUser.Invoke("SetPassword", new object[] { Pswd });
newUser.Properties["Description"].Value = Description;
newUser.Properties["FullName"].Value = Fullname;
newUser.Properties["BadPasswordAttempts"].Value = 3;
newUser.Properties["MaxPasswordAge"].Value = 90;
I get an exception when I try and set those two properties that those
properties aren't in the property cache.
Is there a way to set properties like these on a new user or does this
have to do with the local policies
thanks
mike