Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 7025

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 2162

Deprecated: Hook imagify_allow_picture_tags_for_webp is deprecated since version 2.2! Use imagify_allow_picture_tags_for_nextgen instead. in /www/collab365_296/public/wp-includes/functions.php on line 5758
Change or add UPA user property mapping for specific synchronization connection via PowerShell - Collab365
Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Warning: Undefined array key "url" in /www/collab365_296/public/wp-content/plugins/thrive-visual-editor/thrive-dashboard/inc/smart-site/classes/class-tvd-smart-shortcodes.php on line 85

2014-03-24

Use this script to map AD attribute to SharePoint user profile property for specific synchronization connection in UPA (User Profile Application).
This is useful to remap ‘proxyAdresses’ attribute for WorkEmail property if you changed to ‘mail’ and trying to change it back or other scenario.
If mapping already exists it will be remapped to new value if not – will be added.

Please make sure that you user has rights to access $siteURL and has Full control on UPA. And run the script from elevated SharePoint PowerShell prompt.

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.UserProfiles")

Start-SPAssignment -global

#change to your SP site URL to get the context from
$siteUrl = "http://intranet.contoso.com"
#This is SP User Property
$PropertyName = "WorkEmail"
#This is AD attribute
$attributeName ="mail" #or proxyAdresses
#This is UPA Synchronization connection name. Change it to yours
$connectionName = "SyncConnectionName";


$site = Get-SPSite $siteUrl

$context = Get-SPServiceContext $site

$upConfigManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileConfigManager($context)

$connection = $upConfigManager.ConnectionManager[$connectionName]

#$upConfigManager.ConnectionManager[$connectionName].PropertyMapping.GetEnumerator() > c:\temp\mappings.txt
# Uncomment line above and comment bellow to get all available mappings

$connection.PropertyMapping.AddNewMapping[Microsoft.Office.Server.UserProfiles.ProfileType]::User,$PropertyName,$attributeName)

Stop-SPAssignment -global

Use on your own risk and always test on DEV

(Visited 264 times, 1 visits today)

About the author 

PauliusKe

Summit Bundle

Get 200+ hours of Microsoft 365 Training for 27$!

Master Office 365, Power Platform & SharePoint & Teams With 200+ Hours Of Training Videos and 108 Ebooks in the Collab365 Academy. This offer is insane and is only available for a limited period.