SharePoint 2013 – Update User Profile with Powershell
SharePoint 2013 – Update User Profile with Powershell
Please make sure to execute the script with the Farm Admin Account or any other account that has Full Rights to the User Profile Service Application.
Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue # Get Connection to MySite $MySite = Get-SPSite -Identity "http://mysiteurl.local" # Get Context $context = Get-SPServiceContext($MySite) # Get UserProfileManager Object $ProfileMngr = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context) # Get All User Profiles $profiles = $ProfileMngr.GetEnumerator() # Loop through all User Profiles foreach($profile in $profiles) { Write-Host $profile.get_Item("AccountName") # Get Values #Example Set Value and Commit changes # $profile["AccountName"].value = "domain\name" # $profile.Commit() }