Monday, 18 March 2013

Manually Update User Profile Information from SharePoint via Powershell

A good article on updating user profile info from a site collection from AD using Powershell
http://blog.falchionconsulting.com/index.php/2011/12/updating-sharepoint-2010-user-information/


function Sync-SPUser([string]$userName) {
  Get-SPSite -Limit All | foreach {
    $web = $_.RootWeb
    if ($_.WebApplication.UseClaimsAuthentication) {
      $claim = New-SPClaimsPrincipal $userName -IdentityType WindowsSamAccountName
      $user = $web | Get-SPUser -Identity $claim -ErrorAction SilentlyContinue
    } else {
      $user = $web | Get-SPUser -Identity $userName -ErrorAction SilentlyContinue
    }
    if ($user -ne $null) {
      $web | Set-SPUser -Identity $user -SyncFromAD
    }
    $web.Dispose()
    $_.Dispose()
  }
}


HarePoint Active Directory Self Service
http://www.harepoint.com/Products/HarePointSelfService/Screenshots.aspx