Specific User out of sync with AD? update UserProfile via Powershell with Set-SPUser

Recently we had an issue where we had two web applications running on one farm , sharing the userprofile.

One username was changed in AD and User Profile successfully synced and updated this userprofile account.

When going to the one specific Web Application Site the user once logged in still had the old username as its welcome header.

After a couple of full and incremental syncs of the profile services it still did not update the users info for the specific site while the other site was perfect.

We then turned to powershell for its solution:

PS C:\Users\spsIntAdmin> Get-SPUser -Identity ourcompany32734 -Web http://storeportal | fl

Name : Isithame Usave 054423 ßOLD DATA OUT OF SYNC

Email : 054423

Notes :

LoginName : OURCOMPANY\032734

Groups : {}

OwnedGroups : {}

ID : 4879

Xml : <User ID="4879" Sid="S-1-5-21-343818398-1993962763-1644491937-50661" Name="Isithame Usave 054423" LoginName="OURCOMPANY32734" Email="054423" Notes="" IsSiteAdmin="False" IsDomainGroup="False" Flags="0" />

RawSid : {1, 5, 0, 0…}

Sid : S-1-5-21-343818398-1993962763-1644491937-50661

IsSiteAdmin : False

IsSiteAuditor : False

IsDomainGroup : False

IsApplicationPrincipal : False

RequireRequestToken : False

AllowBrowseUserInfo : True

Alerts : {}

UserToken : Microsoft.SharePoint.SPUserToken

RegionalSettings :

ParentWeb : Store & Regional Portal

Roles : {}

UserLogin : OURCOMPANY32734

DisplayName : Isithame Usave 054423

First we confirmed it was out of sync by Get-SPUser

PS C:\Users\spsIntAdmin> Set-SPUser -Identity ourcompany32734 -Web http://storeportal -SyncFromAD

We then ran a update of the specific user to sync with AD

PS C:\Users\spsIntAdmin> Get-SPUser -Identity ourcompany32734 -Web http://storeportal | fl

Name : Isithame Usave 032734

Email : 032734

Notes :

LoginName : OURCOMPANY\032734 ßBACK IN SYNC

Groups : {}

OwnedGroups : {}

ID : 4879

Xml : <User ID="4879" Sid="S-1-5-21-343818398-1993962763-1644491937-50661" Name="Isithame Usave 032734" LoginName="OURCOMPANY32734" Email="032734" Notes="" IsSiteAdmin="False" IsDomainGroup="False" Flags="0" />

RawSid : {1, 5, 0, 0…}

Sid : S-1-5-21-343818398-1993962763-1644491937-50661

IsSiteAdmin : False

IsSiteAuditor : False

IsDomainGroup : False

IsApplicationPrincipal : False

RequireRequestToken : False

AllowBrowseUserInfo : True

Alerts : {}

UserToken : Microsoft.SharePoint.SPUserToken

RegionalSettings :

ParentWeb : Store & Regional Portal

Roles : {}

UserLogin : OURCOMPANY32734

DisplayName : Isithame Usave 032734

We confirmed its, back in sync.

Thanks PowerShell!

About these ads

One comment

  1. Awesome find the one thing I would add is that you may have to do a :
    get-spuser -web <weburl -Limit ALL| ?{$_.UserLogin -like "*domain\username*"} | fl but most certainly helps when UPS seems to not sync one particular user. I've even thought about taking it to the next level and making an automated script that compares the output of this to the AD attributes and if needed triggers a sync.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s