SharePoint: Script to update User information from AD

In SharePoint some of the user information is stored at the site collection level in user information list (_catalogs/users/simple.aspx). User name and other changes are not synchronized with User profile information  (user last name changed, not updated at site level). The below script can be used to update it at all the site collection.


function Sync-SPUser([string]$userName) {

Get-SPSite -Limit All | foreach {
$web = $_.RootWeb
$user = $web | Get-SPUser -Identity $userName -ErrorAction SilentlyContinue
if ($user -ne $null)
$web | Set-SPUser -Identity $user -SyncFromAD
$path = “D:\Temp\Greg_User_sites.txt”
$web.Url | Out-File -FilePath $path -Append

Sync-SPUser “Contoso\Admin”

Leave a Reply

Your email address will not be published. Required fields are marked *