Domanda

I have noticed strange behaviour with some user accounts in our SharePoint 2013 Enterprise farm.

We have a domain that has a slightly different NetBIOS name than the beginning of our FQDN, and as such we have ran the following script on our SharePoint farm before creating a Profile Sync Connection to our AD:

$var = Get-SPServiceApplication | where {$_.TypeName -eq "User Profile Service Application"}
$var.NetBiosDomainNamesEnabled = "1"
$var.update()
Write-host "NetbiosDomainName Enabled = "$var.NetBiosDomainNamesEnabled

I noticed that we were still pulling in accounts with during the profile sync that had the wrong NetBIOS name, so I decided to delete all accounts from the profile database and re-sync just to be sure. I used powershell to do this, with the following code:

$site = new-object Microsoft.SharePoint.SPSite("https://MYSITE");  
$ServiceContext = [Microsoft.SharePoint.SPServiceContext]::GetContext($site);  
$ProfileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext)    
$AllProfiles = $ProfileManager.GetEnumerator()
foreach($profile in $AllProfiles)  
{  
    $DisplayName = $profile.DisplayName  
    $AccountName = $profile[[Microsoft.Office.Server.UserProfiles.PropertyConstants]::AccountName].Value  
    if($AccountName -like "XSW\*") 
    { 
        $ProfileManager.RemoveUserProfile($AccountName); 
        write-host "Profile for account ", $AccountName, " has been deleted"  
    } 
}  
write-host "Finished." 
$site.Dispose() 

I did this as I had the feeling that a full sync somehow wasn't clearing these accounts out properly. MIISCLIENT.exe had some errors with the sync :

Exception while trying to migrate account 'SW\some-account' to 'XSW\some-account'. ---> Microsoft.SharePoint.SPException: The user does not exist or is not unique. --->

The strange thing is, when a user actually touches the site (logs in) the profile somehow updates to the correct domain name (Please see picture attached) and I am not sure why this is happening!

Strange NetBIOS Behaviour

Has anyone else experienced this before, and is there an explanation for it?

I might have to rebuild the whole profile service application from scratch if I cannot stop this behaviour!

The strange thing is, on my pre-prod environment I didn't have the NetBIOS flag set, so I deleted the sync connection, set the NetBIOS flag, reset the sync connection and then did an import, and it seemed to work. No such luck on the production environment. I accept that I may have to rebuild, I just want to better understand what has happened under the hood.

È stato utile?

Soluzione

I ended up rebuilding the User Profile Service completely to solve this issue.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top