0

I want to run a query which returns all sites in a SharePoint Online tenant (Teams and Non-Teams sites) that do not have a specific Time Zone set in their Regional Settings area, eg 14 which is (UTC-09:00) Alaska.

The scenario is that we are trying to find SharePoint Sites in our tenant that do not have the TimeZone that they should have.

Later, we will want to update the TimeZoneID property of the sites involved to the correct value.

Firstly, I am just trying to visualise where the TimeZoneID property actually resides.

I'm having difficulty trying to find it on a single site - I have tried:

Connection Setup

$TenantSiteURL = "https://*******-admin.sharepoint.com/"

Connect-PnPOnline -Url $TenantSiteURL -Interactive

$identity = "https://*******.sharepoint.com/sites/*******"

Attempts

# this doesn't return any additional details (it only displays 3 values - Url, Template and LocaleId ) 
Get-PnPTenantSite -Identity $identity -Detailed  

# this doesn't return timezone id
Get-PnPTenantSite -Identity $identity | Select *

# this doesn't return timezone id  
Get-PnPTenantSite -Identity $identity | Select -Property *

# this DOES return timzone id, but seems like a convoluted way to get it  
Connect-PnPOnline -Url $identity -Interactive
$web = Get-PnPWeb -Includes RegionalSettings,RegionalSettings.TimeZone

$web.RegionalSettings.LocaleId
# returns the LocaleId value  
$web.RegionalSettings.TimeZone
# returns the TimeZone value  

How can I create a query that returns all sites where TimeZoneID is not equal to X?

Related Cmdlet docs:

https://pnp.github.io/powershell/cmdlets/Get-PnPTenantSite.html

https://pnp.github.io/powershell/cmdlets/Get-PnPWeb.html

user1063287
  • 10,265
  • 25
  • 122
  • 218

0 Answers0