Collaboration-2-Go


Lösungen und Software-Entwicklung im Collaboration Umfeld, insbesondere Microsoft SharePoint, Microsoft Exchange und Microsoft Office.

Support


Mobil: +49 (152) 53 97 78 79
Mail: service@collaboration-2-go.de
Weitere Kontaktmöglichkeiten: Kontaktseite
Dekoration: Köln



Rename SharePoint MySite Blog
Created: 16.11.2013
Categories: SharePoint 2013; SharePoint Development; PowerShell

Want to rename your MySite blogs using PowerShell since all MySite blog names are "Blog"?


# URL to your MySite web application
$MySiteWebUrl = "https://mysite.collaboration-2-go.net"
      
# where to find users in the AD
$searchbase="DC=collaboration-2-go,DC=net"
      
# required if server domain and user domain are different
$dc="my_domain_controller"
      
# required if server language is English and
# MySite language is different
$culture = "de-DE"

$webapp = Get-SPWebApplication -identity $MySiteWebUrl
[System.Threading.Thread]::CurrentThread.CurrentUICulture =
  $culture
        
foreach ($site in $webapp.Sites)
{
  # Get Active Directory Information
  $login = $site.Owner.LoginName
  if ($login.contains("\"))
  {
    $login = $login.substring($login.indexof("\") + 1)
  }
        
  $ldapfilter = "(SamAccountName=" + $login + ")"
  $aduser = Get-ADUser -LDAPFilter $ldapfilter
    -SearchBase $searchbase -Server $dc
  $displayName = $aduser.GivenName + " " + $aduser.Surname
      
  if ($displayName -eq " ")
  {
    $displayName = $site.owner.DisplayName
  }
      
  if ($site.RootWeb.WebTemplate -eq "SPSPERS") # ignore MySite host
  {
    # more sophisticated approach is possible but
    # I'm not sure about the blog URL
    foreach ($web in $site.AllWebs)
    {
      if (($web.WebTemplate -eq "BLOG") -and
        ($web.Title -eq "Blog"))
      {
        $title = "Blog von " + $displayName
        $web.Title = $title
        $web.Update()
      }
          
      $web.Dispose()
    }
  }
        
  $site.Dispose()
}

      
If you don't set the culture SharePoint changes to English title only.
    

Send us a Comment!