SharePoint Online – Change timezone for all SPO Sites

Today i needed to change the TimeZone for a lot of sites, when searching online i found some other scripts but i found them too complicated and needed something easier to manage.

I combined and script some other script and came up with this:

# Define variable
$adminurl = https://tenantname-admin.sharepoint.com
$timezone = "(UTC+01:00) Amsterdam, Berlijn, Bern, Rome, Stockholm, Wenen"

#Connect To SharePoint Online
$AdminCredentials = Get-Credential

#Connect To SharePoint Online
Connect-SPOService -Url $adminurl -Credential $AdminCredentials

#Get all Site Collections
$SitesCollection = Get-SPOSite -Limit ALL

#Change timezone for alle SPO Sites
ForEach($Site in $SitesCollection)
{
Write-host -f Yellow "Setting Timezone for Site Collection:"$Site.URL

Set-SPOnlineTimeZone -SiteURL $Site.URL -TimezoneName $timezone -cred $AdminCredentials

}

I hope it helps someone out..