Changing the Time Zone of a Site using CSOM with PowerShell

Here is a quick example of how you can change the time zone of a site using CSOM with PowerShell, in this example I'll update a single site. Realistically you would only want to automate this if you had a large number of sites that you needed to change.

Simple update the $Site variable (highlighted) and specify the time zone you would like to configure it to use (highlighted). For a list of available time zones, execute $TZs (after running the first three blocks of the script!)

#Add references to SharePoint client assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#Authenticate to Site
$Username = Read-Host -Prompt "Please enter your username"
$Password = Read-Host -Prompt "Please enter your password" -AsSecureString
$Site = "https://tenant.sharepoint.com"
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($Site)
$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username,$Password)
$Context.Credentials = $Creds

#Retrieve the time zones that are available
$TZs = $Context.Web.RegionalSettings.TimeZones
$Context.Load($TZs)
$Context.ExecuteQuery()

#Update the timezone
$RegionalSettings = $Context.Web.RegionalSettings
$Context.Load($RegionalSettings)
$Context.ExecuteQuery()
$TZ = $TZs | Where {$_.Description -eq "(UTC+13:00) Samoa"}
$Update = $RegionalSettings.TimeZone = $TZ
$Context.Web.Update()
$Context.ExecuteQuery()

There are over a 100 to choose from (small selection below).

Brendan Griffin - @brendankarl