PowerShell script to change locale for all sites
In response to a user post on Windows 2008 Forums I wrote this PowerShell script to change the locale (regional settings) for each site in a given site collection, as by default the locale is set to en-US (United States). It leverages the Get-SPWeb command to enumerate sub-sites. Here is the script:
# ======================================================
#
# SharePoint 2010 PowerShell script to change the locale
# setting for all sites within a given Site collection
#
# Author : David Webb
# Date : 3rd August 2013
# Version : 1.0
#
# ======================================================
# -------------
# Set variables
# -------------
$Site = "http://intranet"
$NewLocale = "en-GB"
$Webs = Get-SPWeb -Site $Site
# ------------
# Begin script
# ------------
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"
}
}
And here is a screenshot of the output, colour coded to make it easier to read:
![[BlogBookmark]](http://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/blogbookmark.png)
![[Blogsvine]](http://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/blogsvine.png)
![[del.icio.us]](http://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/digg.png)
![[Facebook]](http://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/facebook.png)
![[Furl]](http://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/furl.png)
![[Google]](http://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/google.png)
![[LinkedIn]](http://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/linkedin.png)
![[MySpace]](http://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/myspace.png)
![[Reddit]](http://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/reddit.png)
![[Slashdot]](http://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/slashdot.png)
![[StumbleUpon]](http://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Twitter]](http://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/twitter.png)
![[Windows Live]](http://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/windowslive.png)
![[Yahoo!]](http://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](http://www.adventuresinsharepoint.co.uk/wp-content/plugins/bookmarkify/email.png)