Change all Time Zones and Regional Settings in SharePoint Online

Problem

  • You have a Microsoft 365 tenant created somewhere other than in the PST time zone
  • After years of growth and site creation, you realize that all the time zones and regional settings on every site in SharePoint Online (SPO) are “defaulted” to en-US and PST
  • You want to update the regional settings on each site programmatically and not per the web interface
  • You have admin access to all these site

Solution

  • Configure this script for your environment and run
  • It has three functions
    • One from Andreas Dieckmann (https://diecknet.de/en/2021/07/09/Sharepoint-Online-Timezones-by-PowerShell), which will convert the regional setting ID numbers used by SharePoint Online into human-readable text
    • A second function which will loop through all the SPO sites that you have access to and return a CSV file with their current settings
    • And a third which will create a “site design” (Json object) for SPO with the regional settings and time zone of your choosing (currently set to de-DE and Central European Time) and then update all SPO-sites in your tenant, including the ability to filter out “system sites” such as APPCATALOG#0

Details

Since you are here, you have surely realized that Microsoft hides a little “feature” in the SharePoint Online admin center that determines the default regional settings for all newly created SPO and Teams sites. By default, this setting is set to PST for the time zone and en-US for the regional settings (number delimiters and date formats and such). If you happen to not live in Redmond, WA with Microsoft, then these are not the settings you want. But like many of my customers, hundreds of sites and teams have already been created with these incorrect settings, which admittedly do not break anything, but are annoying if you want the “last modified on” dates and times to be correct on your file stored in Teams, for example.

Current configuration in the script

As a resident of Germany, my customers are mostly interested in German regional settings and time zone, hence the script is configured for switching the sites to de-DE and CEST time. You can change this in the third function, setSPOSitesTimeZonesToDEStandard, where you will need to update the Json “@script,” where the site design is created (Line 270). Be sure to check the first functions list of IDs to Time Zones and pick the correct region. Then you will want to name the site design something other than “DE_Standard” (Line 287) and update the Write-Host console outputs at lines 336 – 338. Finally, you can play around with which system or non-system sites are affected by the script in lines 331 to 334.

Requirements

You will need admin access to SPO obviously, as the script needs read rights to create the CSV report of the current settings and then of course write rights to be able to update the sites. Use your global admin account. Also, as mentioned in the description in the PowerShell file itself, the update to the settings is performed per CSOM command, so the machine from which you run the script will need all those requirements set up first. Salaudeen Rajack of SharePoint Diary fame has a nice guide on this. Check out his stuff. It is great!

As always, I hope this helps you. Please contact me per the contact form if I can help in any way!

Leave a Reply

Your email address will not be published. Required fields are marked *