Requirement: I came across an issue where the user’s Email was not synched from Active directory.
PowerShell change user Email in SharePoint 2013:
How to change the SharePoint user’s Email with PowerShell? Well, You can use Set-SPUser cmdlet. Just provide the account identity, site, and the new E-mail for the user.
Run this PowerShell cmdlet from SharePoint Management Shell.
Set-SPUser -Identity "i:0#.w|Crescent\Salaudeen" -Email "[email protected]" ` –Web http://intranet.crescent.com
Sync User Account Details such as Display Name, E-mail, Department from Active Directory:
Sometimes, user account details may be updated in AD but not synced in SharePoint. If that’s the case, you can force sync user account details such as display name, E-mail, department, etc from the Active Directory with the below PowerShell script:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #User Account to Sync and Site where the account exists $UserAccount="Crescent\alex" $WebURL="https://portal.crescent.com/projects/" #Get the User's Current Display Name and E-mail Get-SPUser -Identity $UserAccount -Web $WebURL | Select DisplayName,Email #Force Sync from Active Directory Set-SPUser -Identity $UserAccount -Web $WebURL -SyncFromAD
How to Re-Sync All users from Active Directory?
To resync all user details, use this PowerShell script:
Get-SPUser -Web http://web-app-url | Set-SPUser –SyncFromAD