Share via


Configuring People Picker in a one-way trust environment with powershell

You use the People Picker control to find and select users, groups, and claims when a site, list, or library owner assigns permissions in SharePoint 2013. When you have a SharePoint farm and you want to use accounts from another domain you need one-way or two-way trust between those domains. A two-way trust is not always desirable and if you choose one-way trust SharePoint People Picker doesn’t show any accounts from the other domain.

There is a documented solution for this

https://support.microsoft.com/en-us/kb/2384424

But this solution uses stsadm command which will not be available on Sharepoint 2016. This is a sample script to configure this with powershell.

 

$newdomain1= new-object Microsoft.SharePoint.Administration.SPPeoplePickerSearchActiveDirectoryDomain
$newdomain1.DomainName ='mydomain1.local';
$newdomain1.ShortDomainName ='mydomain1';
$user1="mydomain1\myuser"
$pass1=convertto-securestring 'mypasswordformyuser' –AsPlainText -Force
$credentials=new-object –typename System.Management.Automation.PSCredential –argumentlist $user1,$pass1
$newdomain1.LoginName=$credentials.UserName
$newdomain1.SetPassword($credentials.Password)
$wa.PeoplePickerSettings.SearchActiveDirectoryDomains.Add($newdomain1)

$newdomain2 = new-object Microsoft.SharePoint.Administration.SPPeoplePickerSearchActiveDirectoryDomain
$newdomain2.DomainName ='mydomain2.com';
$newdomain2.ShortDomainName='mydomain2';
$user2="mydomain2\myuser2"
$pass2=convertto-securestring 'mypasswordformyuser2' –AsPlainText -Force
$credentials2=new-object –typename System.Management.Automation.PSCredential –argumentlist $user2,$pass2
$newdomain2.LoginName=$credentials2.UserName
$newdomain2.SetPassword($credentials2.Password)
$wa.PeoplePickerSettings.SearchActiveDirectoryDomains.Add($newdomain2)

$wa.Update()

Comments

  • Anonymous
    November 21, 2017
    I get an errornew-object : Cannot find type [Microsoft.SharePoint.Administration.SPPeoplePickerSearchActiveDirectoryDomain]: verify that the assembly containing this type is loaded.