Having created a Staff Directory in SharePoint I realised that the User Profile Synchronisation (UPS) was importing disabled accounts. Obviously for an active staff directory this is of no use and we did not want to have to exclude them all manually.
Solution
Create filter on the user profile information of disabled user accounts from Active Directory to SharePoint.
To filter the disabled user accounts Go to [Central administration]\[application management]\[Manage service applications] \[User profile service application] as shown below
We need to select Synchronisation then Configure Synchronisation connections Select the connection that you wish to modify, drop it down and select edit
From the connections you are using click on Edit connection filters menu. In the Exclusion Filters for Users section you need to use the OR filter so that if you add additional filters they do not combine then select Attribute – UserAccountControl, select the Operator as Bit on equals and the Filter as 2 then select Add
Once you enter the required values click on Add button and it will show the below details in Exclusion filter for users section.
Finally click on ok button to submit the Edit connection filters details. Once you are done wait for full synchronization to run or you can forcefully run one.
If you would like to know learn more about SharePoint or how it can be used to help your business book onto one of our SharePoint courses.