How to change regional settings with PowerShell

Recently I needed to change the regional settings for all the sites and site collection in a SharePoint 2013 farm, so I did it with Powershell.

But also, at the same time I needed to do it for a SPO tenant, so let’s PowerShell!

foreach ($webApplication in Get-SPWebApplication) {
Write-Host "Processing $webApplication"
Write-Host "******************************"

foreach ($site in $webApplication.Sites) {
$webs = $site.AllWebs
Write-Host "Processing $site"
Write-Host "******************************"
foreach ($web in $webs) {
Write-Host $web.Url

#If you need to change the timezone and local id in SharePoint Online, you can do it using the following:

#This is to change the LocalID
#First, set up your ClientContext in the normal manner:
$Password = ConvertTo-SecureString -String "yourPassword" -AsPlainText -Force;
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext("");
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials("", $Password);
#Now we need to set up our target web site object:
$web = $ctx.Web;
#Next, update the settings. In this example, I’m setting the LocaleId to 2057 (en-UK)
$web.RegionalSettings.LocaleId = 2057;
#Finally, run the ExecuteQuery method to apply the changes:

#The following is to change the zoneID for personal sites
Write-Host $persweb
Set-SPOUser -Site $persweb -LoginName $username -IsSiteCollectionAdmin $true

Set-SPoUserRegionalSetings -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl -TimeZoneID $TimeZoneID

If you need to know which time zone ID is your region, visit: to check it

And If you need to check your local ID, visit:



2 thoughts on “How to change regional settings with PowerShell

  1. This script only updates the site collections for on-prem SharePoint and OneDrive, but not all Site Collections in SharePoint Online


    1. Hey Alex, the second part of the script is where the references to SPO take effect, take into account that the commands starts by Set-SPO, it was a while since the last time I executed these commands, so could be a chance that it have been changed.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s