The SharePoint Health Analyzer reported that “People search relevance is not optimized when the Active Directory has errors in the manager reporting”. So in order to fix this problem I wanted to execute the ‘Add-SPProfileLeader’-command on our CEO.
SharePoint, however, stated that “User ‘domain\ceo’ has a manager.”
But in order to be ‘Profile Leader’ the account must not have a manager!
PS C:\Users\sp_farm> Add-SPProfileLeader $SPSAP -Name domain\ceo
Confirm
Are you sure you want to perform this action?
Performing operation "Add-SPProfileLeader" on Target
"domain\ceo".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help
(default is "Y"):Y
Failed. User 'domain\ceo' has a manager.
I checked the AD and to my suprise the Manager-attribute was empty. No matter what I tried, I couldn’t fix this issue until I checked what’s going on in SharePoint’s database itself.
So, here is how I fixed the issue:
I logged in to the database with SQL Server Management Studio and executed the following SQL query:
SELECT [NTName], [Manager] FROM [Profile DB].[dbo].[UserProfile_Full] WHERE [NTName] = 'domain\ceo'
The query returned this:
I’m not exactly sure why the manager attribute was empty, but I assumed that it should be NULL. I changed the value with this SQL query:
UPDATE [Profile DB].[dbo].[UserProfile_Full] SET [Manager] = NULL WHERE [NTName] = 'domain\ceo'
Then I executed the PowerShell-command again and this time it worked.
PS C:\Users\sp_farm> Add-SPProfileLeader $SPSAP -Name domain\ceo
Confirm
Are you sure you want to perform this action?
Performing operation "Add-SPProfileLeader" on Target
"domain\ceo".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help
(default is "Y"):Y
User 'domain\ceo' added as a leader.
Please note that manual alterations to the database are not supported by Microsoft.
I hope that helps someone!