Update People Picker Using PowerShell

Recently had a new domain added to our forest. After this happened, users would see duplicate values in the SharePoint people picker. The values would both look like John Doe and John Doe, but their underlying domains were different. This caused all sorts of fun when people started emailing “john doe can’t access my site.”

To fix this, the people picker property for each web application in the farm needed to be updated.

There are a lot of properties and options that you can update. I’m only updating my people picker to show one domain.

More on the people picker:
http://msdn.microsoft.com/en-us/subscriptions/cc263012(v=office.12).aspx


#add the powershell snapin

$contentWebAppServices = (Get-SPFarm).services |
 ? {$_.typename -eq "Microsoft SharePoint Foundation Web Application"}

foreach($webApp in $contentWebAppServices.WebApplications)
{
 Set-SPSite $webApp.Url -UserAccountDirectoryPath "DC=YourDomain,DC=Com"
}

What I’m doing is getting all the web applications in the SharePoint farm.  Looping through the applications and updating the people picker.

Leave a Reply

Your email address will not be published. Required fields are marked *