Our customer has switched his AD to a new one. We have migrated users in SharePoint, but the User Profile Service doesn’t work for 73 of 7024 users. These users can log in to SharePoint, but doesn’t have access to AD-group content. I’ve tried to follow the post SharePoint 2010–User Information Lists and User Profile Cleanup where I use the following script:

$upa = Get-SPServiceApplication <identity>
Set-SPProfileServiceApplication $upa -GetNonImportedObjects $true
Set-SPProfileServiceApplication $upa -PurgeNonImportedObjects $true

I get no error message, but the 73 user accounts remain. The idea was to run a full user profile sync when the user accounts were removed, but the user accounts are still there. Why doesn’t this work on a SharePoint 2010 Server solution?

  • Did you find a way to show the progress of the purge imported objects or just take it on faith the command is running?
    – Iedaddy
    Commented Jul 27, 2012 at 0:42
  • @Iedaddy Not really - one just have to wait until the script completes, which is OK since it's on a server and one can continue to work elswhere while the script completes. At least I didn't find anything useful while processing the script.
    – Benny Skogberg
    Commented Jul 30, 2012 at 8:33

2 Answers 2


As it turns out, the script worked - but it took a long time. On 7000+ users (in my environment) I had to wait more than an hour before I could see any difference. Six hours later the changes where made.

I refined the script above to this:

$upsa = Get-SPServiceApplication | Where-Object {$_.TypeName -like "User Profile Service Application"}

# List all user accounts that is not imported correctly
Set-SPProfileServiceApplication $upsa -GetNonImportedObjects $true

# Remove user accounts not imported correctly 
# Uncomment line below to run
# Set-SPProfileServiceApplication $upsa -PurgeNonImportedObjects $true

# Run a full User Profile Service Syncronisation, and make sure users end up in Profile database.
# If not, users who log in will create new NonImportedObject accounts

This probably happens because you flag the users to be deleted, and not acctually deletes the user within the operation Set-SPProfileServiceApplication $upsa -PurgeNonImportedObjects $true.

  • This can delete also the users that have been disabled in AD? (and are still on SharePoint)
    – Nk SP
    Commented Nov 10, 2014 at 17:07
  • @Nk_SP I guess so. They should be deleted automatically, but if not, this will remove user profiles from SharePoint.
    – Benny Skogberg
    Commented Nov 10, 2014 at 17:16

There is a timer job called: MySite clean up timer jobs does the deletion for you, and it is usually scheduled to run hourly, so just grab a coffee and wait for an hour.

  • This is not really true. It is correct that MySite Clean up timer job deletes profiles of non imported users. But you do not have to use it to delete users marked for deletion through the command: Set-SPProfileServiceApplication $upa -PurgeNonImportedObjects $true You just need to give it some time for the profiles to be deleted.
    – Skaft
    Commented Aug 25, 2017 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.