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: