I'm currently looking for a new job, preferably in the Asia-Pacific region but I would consider other regions as well. If you are hiring or have any leads, I would appreciate if you would drop me a message via the contact form, e-mail (daniel(at)spoodoo.com), Twitter, or LinkedIn.


Daniel

Fix “User ‘xxx\xxx’ has a manager” when using the Add-SPProfileLeader PowerShell command


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!

Tweet about this on TwitterShare on RedditShare on FacebookShare on Google+Share on LinkedInShare on StumbleUponShare on TumblrPin on PinterestDigg thisPrint this pageEmail this to someone

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *

*