User Profile Service Synchronization Connection in SharePoint specifies the source for importing user profiles from Active Directory or any other profile source. The user profile import operation is unidirectional in SharePoint 2016 (from Active Directory to SharePoint) which populates user profile data in user profile service application from Active Directory.
How to Create a user profile synchronization connection for SharePoint using PowerShell?
As in previous versions of SharePoint, An import connection can be created for the user profile service application. To add a new synchronization connection in SharePoint 2016:
- Go to SharePoint 2016 Central Administration >> Application Management
- Manage Service applications >> select User Profile Service application
- On User profile service application page, click on “Configure Synchronization Connections” >> Create New Connection
- Fill in the details according to your environment. Such as:
- Connection Name, The Fully Qualified Domain Name, Authentication Provider Type
- The user account and password of the account will retrieve the user profile information.
- The TCP Port (defaults to 389, for LDAP). Whether to use an SSL-secured connection, filter out disabled users, and another option for Filtering in the LDAP syntax.
- Click on Populate Containers and Select which container in Active Directory is to be synchronized in this connection.
PowerShell Script to create user profile synchronization connection:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Configuration Parameters $ImportDomain = "Crescent" $ImportUserName="SP16_ProfileImport" $ImportPassword = Read-host "Enter the Password for Import Account:" -AsSecureString $ServiceAppName="User Profile Service Application" $ImportOU="OU=Users,DC=Crescent,DC=com" $ForestName="Crescent.com" $FilterDisabledUsers = $True #Get User Profile Service application $UPS=Get-SPServiceApplication -Name $ServiceAppName #Create User Profile Synchronization Connections Add-SPProfileSyncConnection -ProfileServiceApplication $UPS -ConnectionForestName $ForestName -ConnectionDomain $ImportDomain -ConnectionUserName $ImportUserName -ConnectionPassword $ImportPassword -ConnectionSynchronizationOU $ImportOU -ConnectionUseDisabledFilter $FilterDisabledUsers