Tuesday, November 19, 2013

SharePoint Set Locale Region on All Web Applications and Site Collections

A quick script works on both SharePoint 2010 and 2013. Make sure to update en-AU to the target locale you are after =).

Enjoy!

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
$websvcs = $farm.Services | ? -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]}
$webapps = @()
foreach ($websvc in $websvcs)
{
$NewLocale = "en-AU"
foreach ($webApp in $websvc.WebApplications)
{
foreach ($site in $webApp.Sites)
{
Write-Host "Updating Site -" $site -ForegroundColor "Green"
     
$Webs = $site.AllWebs
ForEach ($Web In $Webs)
{
   If ($Web.locale -ne $NewLocale)
   {
      Write-Host $Web.title "- " -NoNewLine; Write-Host "changing from" $Web.locale "to" $NewLocale -ForegroundColor "Green"
      $Web.Locale = $NewLocale
      $Web.Update()
      $Web.Dispose()
   }
   Else { Write-Host $Web.title "- " -NoNewLine; Write-Host "already set to" $NewLocale -ForegroundColor "Blue"
   }
}
}
}
}

2 comments:

  1. Looking at the feedback I've got from my previous article about building a self-hosted Wordpress blog for free, and from personal experience. Web hosting reviews for small business

    ReplyDelete
  2. its really fantastic blog . its realy informational and a such a good job. i love this
    web hosting reviews

    ReplyDelete