On our SharePoint 2013 environment, we have 2 domains attached and are trying to remove the content of an OU of the format:


I've tried various options, including

$wa.PeoplePickerSettings.ActiveDirectoryCustomFilter =:

$LDAPFilter = "(&(objectClass=user)(!memberOf=CN=SharePoint_Exclude,OU=subgroup,OU=group,DC=company,DC=co,DC=uk))"

$LDAPFilter = "(&(objectClass=user)(!memberOf=CN=SharePoint_Exclude,OU=Distribution Groups,OU=Groups,DC=company,DC=co,DC=uk))"

$LDAPFilter = "(&(objectCategory=user)(objectClass=user)(!OU=subgroup,OU=group,DC=company,DC=co,DC=uk))"

...and tried excluding disabled accounts:
$LDAPFilter = "(&(objectCategory=person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2))"

...but I tend to get either all accounts from the domain or none. Its also complicated as my understanding is that PeoplePicker also retains "User Information List" entries, so its difficult to test!

Please could someone help me establish the correct syntax so at least I know this part is correct?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.