We have had this problem for a while which causes no end of problems. We have accounts which are removed from the OU LDAP filter for User Profiles. However - whenever a user account is removed from AD (disabled or deleted) the user is never removed from SP User Profile sync.

It is then a manual process to go in and remove, our organization now wants this process cleaned up and automated as it has flow on issues.

Is there something I am missing. The My Site Cleanup Job runs daily but does not remove old accounts. I am not overly familiar with this function.

Is anyone able to shed some light on it - or has someone had the same issues and found a solution?

1 Answer 1


This is expected behavior when using AD Import. AD Import will not automatically do anything to a profile that no longer falls into the scope of the import (e.g. if you begin filtering which would exclude profiles, those profiles that would be excluded will not be removed).

If you need to have profiles marked as deleted/removed automatically, use MIM as your sync engine instead.

As a workaround, sometimes it was suggested to use the command:

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

More information for your reference:


  • Thanks Julie. We don't have MIM installed or setup. With the script above you say it is a workaround and it is sometimes suggested. Does this imply it cannot be used on a regular basis - is it unstable or unreliable?
    – garvon-77
    Nov 15, 2021 at 21:00
  • Deleting user profiles with this script will delete just the user profile. This will not delete their My Site or send out that notification like the My Site cleanup job.
    – Julie_MSFT
    Nov 16, 2021 at 9:10
  • If the script is used to delete user profiles before the My Site cleanup runs, will the My Site cleanup still run and be effective in removing their My Site?
    – garvon-77
    Nov 16, 2021 at 21:30
  • Yes, for detailed information, please refer to this article:joshroark.com/…
    – Julie_MSFT
    Nov 19, 2021 at 6:25

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.