Associate Site Collection to Single OU in Active Directory

When a site collection got created in SharePoint , It usually has a default data connection with the Active Directory to read all users from all OUs.

What if you need to restrict this site collection to be able to read ,fetch and add users from a just single OU in Active Directory.

Using the following Powershell command you will be able to do that , it re-configures the directory path and modified to read from the chosen OU

 

Set-SPSite -Identity "<<SiteCollectionURL>>" -UserAccountDirectoryPath "ou=ChosenOU,dc=domain,dc=local"