In this article we will be seeing how to remove AD mapping from a user property in SharePoint 2010 using PowerShell. AD mapping in SharePoint 2010 We can map an AD property to user property so that the value for the user property will be imported from AD in SharePoint 2010 from Central Administration. Go to Central Administration => Application Management => Manage Service Applications => User Profile Service Application. Click on Manage User Properties Click on the User property and then click on Edit in the ECB menu. You could see the user property is mapped to one of the AD property. Automation: Remove AD mapping from a user property in SharePoint 2010 using PowerShell Here we will be seeing how to remove AD mapping from user property in SharePoint 2010 using PowerShell. Steps Involved:
RemoveADMapping.xml <?xml version="1.0" encoding="utf-8" ?> <RemoveADMapping> <SiteURL>http://serverName:8080/</SiteURL> <ADProperty Name="manager" ConnectionName="Domain Users" ></ADProperty> </RemoveADMapping > RemoveADMapping.ps1 #----------------Get the xml file---------------------------------------------------------------
[xml]$xmlData=Get-Content "C:\Users\Desktop\ContentSources\RemoveADMapping.xml"
#----------------Create new custom User Profile section--------------------------------------------- function RemoveADMapping() { $site = Get-SPSite $xmlData.RemoveADMapping.SiteURL $context = Get-SPServiceContext($site) $upcm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileConfigManager($context) $cm = $upcm.ConnectionManager $Deployment.UserProfileProperties.RemoveADMapping.ADProperty | ForEach-Object{ $connection = $cm[$_.ConnectionName] if($connection -ne $null) { $pm = $connection.PropertyMapping[$_.Name]; if($pm -ne $null) { $pm.Delete(); } else { Write-Host -f Yellow "AD Property" $_.Name " is not mapped to any user property" } } else { Write-Host -f Yellow $_.ConnectionName " does not exists" } }} #----------------Calling the function---------------------------------------------
RemoveADMapping Run the Script:
Go to Start.
Click on All Programs.
Click on Microsoft SharePoint 2010 Products and then click on SharePoint 2010 Management Shell.
Run the C:\Users\Desktop\ContentSources\RemoveADMapping.ps1
And in the Central Administration you could edit and see the user property, the AD property mapping will be removed from the user property.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: