使用 PowerShell 在 SharePoint 2016 中创建用户配置文件同步连接
SharePoint 中的用户配置文件服务同步连接指定从 Active Directory 或任何其他配置文件源导入用户配置文件的源。用户配置文件导入操作在 SharePoint 2016 中是单向的(从 Active Directory 到 SharePoint),它从 Active Directory 填充用户配置文件服务应用程序中的用户配置文件数据。
如何使用 PowerShell 创建 SharePoint 的用户配置文件同步连接?
与以前版本的 SharePoint 一样,可以为用户配置文件服务应用程序创建导入连接。要在 SharePoint 2016 中添加新的同步连接:
- 转到 SharePoint 2016 管理中心 >> 应用程序管理
- 管理服务应用程序 >> 选择 User Profile Service 应用程序
在用户配置文件服务应用程序页面上,单击“配置同步连接”>>创建新连接
根据您的环境填写详细信息。例如:
- 连接名称、完全限定域名、身份验证提供程序类型
- 通过该帐户的用户帐号和密码将检索用户个人资料信息。
-
TCP 端口(对于 LDAP,默认为 389)。是否使用 SSL 安全连接、过滤掉禁用的用户以及 LDAP 语法中的另一个过滤选项。
- 单击“填充容器”并选择要在此连接中同步 Active Directory 中的哪个容器。
用于创建用户配置文件同步连接的 PowerShell 脚本:
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

