I am facing a problem regarding the users' information inside the
userdisp.aspx Page, not being in-sync with Active Directory.
Now we have the following settings:-
- SharePoint 2013 on-premises farm with enterprise edition.
- we did not configure any connection inside the User Profile managed service.
now the problem i am facing is as follow:-
when i click on a username inside sharepoint, i got mainly 3 info about the user inside the "userdisp.aspx" Page as follow:-
now sometimes the Name and Work email are being out of sync with Active Directory. so i find this script which i can run on site collection basses, which will update the Work Email and Name inside SP to match AD:-
Get-SPUser –Web "http://servername/sites/WikiSite" | Set-SPUser –SyncFromAD
- the above script have worked well on many users, but it raised the following exception on all the users which have their Accounts values inside SP not equal to their Accounts on AD:-
Set-SPUser : Cannot get the full name or e-mail address of user "i:0#.w|ad-****\****.****". At line:1 char:60 + Get-SPUser –Web "http://servername/sites/WikiSite" | Set-SPUser –SyncFromA ... + ~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (Microsoft.Share...SPCmdletSetUser:SPCmdletSetUser) [Set-SPUser],
SPException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletSetUser
so i have concluded that the above script will base its sync on the Account values inside SP & AD. and as a result if the Account on SP & AD are not equal the script will fail to sync those users' info.
so my questions are:-
is there a way i can sync the Account values between SP & AD? so before running my above script, i can sync the Users' Accounts?
i noted this behavior by chance. is that i use to have a user whose Account was updated inside AD. and as a result his Account on SP was not equal his Account on AD. but when i added the user inside a sharepoint group, i noted that his Account on SP got updated to match his Account on AD.. so what is the relation between adding a user to a SP group and having his Account updated inside SP. and could i benefit from this to Sync all the users' accounts between SP and AD??