Experiences of an Inland Empire Dad

SharePoint 2010–User Information Lists and User Profile Cleanup

Recently I was working on a farm and finally got around to being able to enable the User Profile Sync to Active Directory.  Everything worked beautifully, but there was a problem in SharePoint with orphaned users in the UIL.  There are two reasons why obsolete users or groups can exist in the SharePoint Server 2010 user profile store:

Since this was upgraded from a 2007 farm and there was a period of time when the Farm was not syncing with AD, we had a period of time when several colleagues were removed from AD who had been using the new upgrade farm; However, they still had entries in the UIL, and once the UPA was set up to sync with AD, SharePoint orphaned these UIL entries.  The solution for this is a pretty simple PowerShell script.

1. Open SharePoint PowerShell window.

2. Enter the following in order to get the User Profile Service guid.

Get-spserviceapplication

3. Now using the UPS ID, type the following

$upa = Get-spserviceapplication <identity>

4. To see your Orphaned Accounts, use the following:

Set-SPProfileServiceApplication $upa -GetNonImportedObjects $true

5. Assuming everything looks as it should and you want to get rid of these Orphaned Accounts, use the following command (which is the point of no return as there is no recycle bin for these orphaned users).

Set-SPProfileServiceApplication $upa -PurgeNonImportedObjects $true

And now your orphaned accounts in the User Information List is all cleaned up!