SharePoint 2010

I recently used the following command to target a specific Active Directory Organizational Unit set of users.

stsadm -o setsiteuseraccountdirectorypath -path "OU=My Employees,OU=User Accounts,OU=New Structure,DC=corp,DC=mydomain,DC=net" -url https://mysite

This worked well, but soon realized that Contractors are placed in a slightly different OU. Their path looks like: OU=My Contractors,OU=User Accounts,OU=New Structure,DC=corp,DC=mydomain,DC=net

I discovered that users in this path could not login to SharePoint.

So my question is, how can I exclude certain paths or include more than one? My main goal is to avoid including Service Accounts which are located in an OU all their own. Like this: OU=Service Accounts,OU=User Accounts,OU=New Structure,DC=corp,DC=mydomain,DC=net

Thank you.

1 Answer 1


UserAccountDirectoryPath only supports a single value. You can use peoplepicker-searchadcustomfilter to create an LDAP filter, though you need to have object attributes to filter from (the DN won't be one of the applicable attributes).

Filter Active Directory accounts by using LDAP queries

  • Thanks Trevor. I'll look into this. Question, what is "DN" that you mention?
    – gsr51
    Feb 26, 2020 at 19:36
  • It is the attribute distinguishedName.
    – user6024
    Feb 26, 2020 at 22:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.