Working with DirectoryEntry out of domain, user password setting never expires

I want the user password check to never end. When I create a user, the validation is always not validated.

My code.

DirectoryEntry user = root.Children.Add(adUserName, "user");
          // NOTE(cboivin): Documentation : http://msdn.microsoft.com/en-us/library/aa746340(VS.85).aspx         
          user.Invoke("SetPassword", new object[] { adUserPassword });
          // NOTE(cboivin): Ne pas mettre les clefs dans les ressources, Description, PasswordExpirationDate, AccountExpirationDate
          user.Invoke("Put", new object[] { "Description", Nms.SiteAccess.Business.Manager.ActiveDirectory._resources.WindowsPermissionManager.UserCreerAutomatiquement + args.AddDescriptif });
          user.Invoke("Put", new object[] { "PasswordExpirationDate", args.PasswordExpiration });
          user.Invoke("Put", new object[] { "AccountExpirationDate", args.AccountExpiration });

          user.CommitChanges();

      

+2


source to share


1 answer


Check out the SO thread ...



user.Invoke("Put", new object[] {"UserFlags", 0x10000});

      

+5


source







All Articles