Getting MinRequiredPasswordLength from AD configuration C#

413 Views Asked by At

I want to know the MinRequiredPasswordLength that is configured in AD. Because when I debug:

Membership.MinRequiredPasswordLength

it always returns '7' and in AD it's configured to 8. I know that this property can be changed from web.config (I don't have it specified), but I want to recover it from AD.

Thanks.

1

There are 1 best solutions below

0
On

In recent versions of AD, this is no longer a global setting. It is actually per-user as a feature called Fine Grained Password Policies (FGPP) shipped a few years ago and allows you to override password policies on a per-user basis.

Thankfully, the AD team shipped some tooling to help you.

The closest match to what you're after IMO is also an attribute (on the user) called msDS-ResultantPSO which can tell you the final resultant policy on this user (a la RSOP.msc if you are familiar with that from the Group Policy world). This is query-able over LDAP.

More data on all of this here: http://technet.microsoft.com/en-us/library/cc754544(v=ws.10).aspx