Here is a Quick look at what’s new with the Mysite Cleanup job in Sharepoint On-Prem 2016 & how it impacts the functionality of profile deletion & cleanup .
How this worked in Sharepoint 2010 / Sharepoint 2013 ?
The user profile in the profile store can be marked for deletion (bdeleted=1) when the actual user is deleted or it meets a User filter in FIM (eg:UserAccountControl bitonequal 2). When the mysite clean up job is executed, such profiles are immediately deleted and corresponding mysites are kept for 14 days for data recovery.
Note : While AD import is configured, you will need to execute a set of commands to get the disabled / deleted users marked for deletion
Ref: https://blogs.msdn.microsoft.com/spses/2015/03/04/sharepoint-2013-active-directory-import-and-known-behaviors/ and https://blogs.msdn.microsoft.com/spses/2014/04/13/sharepoint-2013-adimport-is-not-cleaning-up-user-profiles-in-sharepoint-whose-ad-accounts-are-disabled/
Whats new in Sharepoint 2016 ?
The SharePoint 2016 works similar to Sharepoint 2013 , however the profiles marked for deletion (bdeleted=1) will not be immediately deleted, such profiles will be preserved for 30 days.
This is how a profile look like when its active.
When the user is marked for deletion , the bdeleted and NTName values are updated. The NTName column value will be appended with the UserID.
To calculate the 30 days retention , we have introduced a new table (upa.userprofilescheduledforremoval) and the value will be populated when the user is marked for deletion. When the mysite Clean up job runs , it queries this table and picks up the profiles that are more than 30 days and process them.
Note : It is not recommended to Query any Sharepoint databases manually or to make changes other than ones described at http://support.microsoft.com/kb/841057 .
I see the Profiles in my farm are never Deleted , Even after 30 days & Successful Run of Mysite Cleanup Job ?
We at Microsoft are already aware of this issue & working to get this addressed in one our upcoming updates . Such profiles can be removed manually, using Central Admin or PowerShell script as needed . We will update this post once we have more info on the fix .
POST By : Manjesh Menon [MSFT]