Tag Archives: Regional Settings

Powershell script to update regional settings

Requirement

Update the regional settings of all site collections and their subsites to the correct locale.

Solution

[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)
$site = Get-SPSite(“url to site collection”)
$webs = $site.AllWebs
foreach ($web in $webs) {
##Write-Host $web.Url
$culture=[System.Globalization.CultureInfo]::CreateSpecificCulture(“en-AU”)
$web.Locale=$culture
$web.Update()
$web.Dispose()
Write-Host $web.Url
}
$site.Dispose()

Update:

I recently updated this script to update the regional settings on every web application, site collection and subsite in the farm.

[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)
foreach ($webApplication in Get-SPWebApplication) {
Write-Host
Write-Host “Processing $webApplication”
Write-Host “******************************”

foreach ($site in $webApplication.Sites) {
$webs = $site.AllWebs
Write-Host
Write-Host “Processing $site”
Write-Host “******************************”
foreach ($web in $webs) {
$culture=[System.Globalization.CultureInfo]::CreateSpecificCulture(“en-AU”)
$web.Locale=$culture
$web.Update()
$web.Dispose()
Write-Host $web.Url
}
}
}

 

Testing

This script updates all subsites specified in the site collection “$site =” to Australian locale.

 

Comments ( 0 )