20 Jul 2011

Tips for Different FQDN and NetBIOSName in SharePoint 2010 User Profiles

SharePoint, SharePoint, and SharePoint again. Today I want to post something about how we can import from Active Directory but with the FQDN and NetBIOSName completely different. If your domain FQDN is (for example) gembelcorpse.co.id, and your NetBIOS Name set to GC, then you do have a problem. When you let this SharePoint User Profile imports from your active directory, it will make the User Profile import like GEMBELCORPSE\administrator, or GEMBELCORPSE\user1, and that’s totally wrong.

In the previous version of SharePoint (2007), we don’t need to do this tips, all things are automatically done by system. Now, in SharePoint 2010, we must do this kind of tips. So, take a look at this PowerShell code.

Code Snippet
  1. param($ServiceApplicationName)
  2. $ServiceApps = Get-SPServiceApplication
  3. $UserProfileServiceApp = ""
  4. foreach ($sa in $ServiceApps)
  5.   {if ($sa.DisplayName -eq $ServiceApplicationName)
  6.     {$UserProfileServiceApp = $sa}
  7.   }
  8. if ($UserProfileServiceApp -eq "")
  9. {
  10.     Write-Host "Ooops..., Service Application '$($ServiceApplicationName)' not found."
  11. }
  12. else
  13. {
  14.     Write-Host "Found '$($UserProfileServiceApp.DisplayName)'..."
  15.     if ($UserProfileServiceApp.NetBIOSDomainNamesEnabled -eq 1)
  16.     {
  17.         Write-Host "NetBIOSDomainNamesEnabled in '$($UserProfileServiceApp.DisplayName)' already enabled, nothings updated!"
  18.     }
  19.     else
  20.     {
  21.         Write-Host "Press any key to continue, [Esc] to cancel..."
  22.         $Key = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
  23.         if ([int]$Key.Character -eq 27)
  24.         {
  25.             Write-Host "Canceling update to '$($UserProfileServiceApp.DisplayName)'..."
  26.         }
  27.         else
  28.         {
  29.             $UserProfileServiceApp.NetBIOSDomainNamesEnabled = 1
  30.             $UserProfileServiceApp.Update()
  31.             Write-Host "Done Updating '$($UserProfileServiceApp.DisplayName)'!"
  32.             Write-Host "Please run Full Synchronization to import all User Profile."
  33.         }
  34.     }
  35. }

With that PowerShell code, run it using SharePoint PowerShell, you can run it from Start menu > Microsoft SharePoint 2010 Products > SharePoint 2010 Management Shell.

image

Run it using –ServiceApplicationName argument. If your User Profile Service Application Name is User Profile SSA, then you should run it like this command below.
.\SP2010EnableNetBIOSName.ps1 -ServiceApplicationName "User Profile SSA"

image

NOTE: You must run this script on a newly created User Profile Service Application. If you already have the existing, you must delete it, or create another User Profile Service Application. Don’t do the Full Synchronization, configure it first (point to active directory), and then run this script, and then run the Full Synchronization of your User Profile Service Application.

Nice….! click +1 if you do like Winking smile

Tidak ada komentar:

Posting Komentar

[give me your ideas, hopes, comments and compliments below...]
[aaand...... +1 if you need to....]