Borrowed from https://social.technet.microsoft.com/Forums/sharepoint/en-US/32ee6549-9f45-4893-9a88-1b7b8ffa8f62/removal-of-disabled-ad-users-in-sharepoint-2010-user-profile credit to https://social.technet.microsoft.com/profile/maartensundman/
To filter/exclude users during imports, do the following:
- Go to Central Administration and under Application Management, click Manage service applications
- Click on the link to your User Profile Service Application
- Under Synchronization, click Configure Synchronization Connections
- Click on the connection you want to filter and select Edit Connection Filters from the drop down
- Under Exclusion Filter for Users, select whether the statement should be “AND” or “OR” (So if you have multiple filter statements, make sure you pick the right one)
- Select the Attribute to filter (wait for the page to reload as it’s updating the Operator fields)
- Select the Operator to use (changes based on attribute)
- Input the filter value into the Filter field
- Click Add to include the exclusion filter
Examples
Exclude disabled users:
- Attribute – userAccountControl
- Operator – Bit on equals
- Filter – 2