Wednesday, February 3, 2016

Update User info in SharePoint site using Powershell

Sometimes user do report issue where their user information is not updated in SharePoint. It may happens that AD does sync all info and update on sharepoint site. In such cases, you can use below quickfix powershell command to update particular user info:

$site = Get-SPSite "https://Siteurl"

$web = $site.RootWeb

$list = $web.Lists["User Information List"]

#the account is using our trusted ADFS Identity Provider

$i = $list.Items | where {$_["Account"] -eq "domain\username"}

$i["Work e-mail"] = "emailaddress@asdf.com"

$i.update()
$web.Dispose()
$site.Dispose()

or  you can also use below command to update same:

$web = get-spweb "SiteCollection URL" 
$user = $web.EnsureUser("domain\username") 
echo $user
Set-SPUser -Identity $user -Email "email@yourdomain.com" -Web "SiteCollection URL"
 
 

No comments:

Post a Comment