[GH-ISSUE #2291] [Feature Request]: Change Regional Settings #1175

Closed
opened 2026-03-02 13:42:10 +03:00 by kerem · 1 comment
Owner

Originally created by @AndyProsser on GitHub (Apr 2, 2024).
Original GitHub issue: https://github.com/KelvinTegelaar/CIPP/issues/2291

Description of the new feature - must be an in-depth explanation of the feature you want, reasoning why, and the added benefits for MSPs as a whole.

One of the most requested changes for clients is to change the regional settings for their SharePoint Online sites (and OneDrive). Specifically, the date formats for document libraries and lists. Most countries outside of the USA use different date formats than MM/DD/YYYY.

As a minimum we change the Locale & Timezone.

We use a PowerShell script to perform these changes
(Source: https://www.sharepointdiary.com/2019/06/sharepoint-online-change-regional-settings-using-powershell.html)

It would be amazing to add a new Standards rule to ensure regional formats are correct for the desired region.

PowerShell commands you would normally use to achieve above request

#Parameter
$TenantAdminURL = "https://Crescent-admin.sharepoint.com"
$LocaleId = 2057 # UK
$TimeZoneId = 2 # London
 
#Function to Set Regional Settings on SharePoint Online Web
Function Set-RegionalSettings
{ 
    [cmdletbinding()]
    Param(
        [parameter(Mandatory = $true, ValueFromPipeline = $True)] $Web
    )
  
    Try {
        Write-host -f Yellow "Setting Regional Settings for:"$Web.Url
        #Get the Timezone
        $TimeZone = $Web.RegionalSettings.TimeZones | Where-Object {$_.Id -eq $TimeZoneId} 
        #Update Regional Settings
        $Web.RegionalSettings.TimeZone = $TimeZone
        $Web.RegionalSettings.LocaleId = $LocaleId
        $Web.Update()
        Invoke-PnPQuery
        Write-host -f Green "`tRegional Settings Updated for "$Web.Url
    }
    Catch {
        write-host "`tError Setting Regional Settings: $($_.Exception.Message)" -foregroundcolor Red
    }
}
 
#Connect to Admin Center
$Cred = Get-Credential
Connect-PnPOnline -Url $TenantAdminURL -Credentials $Cred
   
#Get All Site collections - Exclude: Seach Center, Mysite Host, App Catalog, Content Type Hub, eDiscovery and Bot Sites
$SitesCollections = Get-PnPTenantSite | Where -Property Template -NotIn ("SRCHCEN#0", "REDIRECTSITE#0", "SPSMSITEHOST#0", "APPCATALOG#0", "POINTPUBLISHINGHUB#0", "EDISC#0", "STS#-1")
   
#Loop through each site collection
ForEach($Site in $SitesCollections)
{
    #Connect to site collection
    Connect-PnPOnline -Url $Site.Url -Credentials $Cred
  
    #Call the Function for all webs
    Get-PnPSubWeb -Recurse -IncludeRootWeb -Includes RegionalSettings, RegionalSettings.TimeZones | ForEach-Object { Set-RegionalSettings $_ }
}
Originally created by @AndyProsser on GitHub (Apr 2, 2024). Original GitHub issue: https://github.com/KelvinTegelaar/CIPP/issues/2291 ### Description of the new feature - must be an in-depth explanation of the feature you want, reasoning why, and the added benefits for MSPs as a whole. One of the most requested changes for clients is to change the regional settings for their SharePoint Online sites (and OneDrive). Specifically, the date formats for document libraries and lists. Most countries outside of the USA use different date formats than MM/DD/YYYY. As a minimum we change the Locale & Timezone. We use a PowerShell script to perform these changes (Source: https://www.sharepointdiary.com/2019/06/sharepoint-online-change-regional-settings-using-powershell.html) It would be amazing to add a new Standards rule to ensure regional formats are correct for the desired region. ### PowerShell commands you would normally use to achieve above request ``` PowerShell #Parameter $TenantAdminURL = "https://Crescent-admin.sharepoint.com" $LocaleId = 2057 # UK $TimeZoneId = 2 # London #Function to Set Regional Settings on SharePoint Online Web Function Set-RegionalSettings { [cmdletbinding()] Param( [parameter(Mandatory = $true, ValueFromPipeline = $True)] $Web ) Try { Write-host -f Yellow "Setting Regional Settings for:"$Web.Url #Get the Timezone $TimeZone = $Web.RegionalSettings.TimeZones | Where-Object {$_.Id -eq $TimeZoneId} #Update Regional Settings $Web.RegionalSettings.TimeZone = $TimeZone $Web.RegionalSettings.LocaleId = $LocaleId $Web.Update() Invoke-PnPQuery Write-host -f Green "`tRegional Settings Updated for "$Web.Url } Catch { write-host "`tError Setting Regional Settings: $($_.Exception.Message)" -foregroundcolor Red } } #Connect to Admin Center $Cred = Get-Credential Connect-PnPOnline -Url $TenantAdminURL -Credentials $Cred #Get All Site collections - Exclude: Seach Center, Mysite Host, App Catalog, Content Type Hub, eDiscovery and Bot Sites $SitesCollections = Get-PnPTenantSite | Where -Property Template -NotIn ("SRCHCEN#0", "REDIRECTSITE#0", "SPSMSITEHOST#0", "APPCATALOG#0", "POINTPUBLISHINGHUB#0", "EDISC#0", "STS#-1") #Loop through each site collection ForEach($Site in $SitesCollections) { #Connect to site collection Connect-PnPOnline -Url $Site.Url -Credentials $Cred #Call the Function for all webs Get-PnPSubWeb -Recurse -IncludeRootWeb -Includes RegionalSettings, RegionalSettings.TimeZones | ForEach-Object { Set-RegionalSettings $_ } } ```
kerem 2026-03-02 13:42:10 +03:00
Author
Owner

@KelvinTegelaar commented on GitHub (Apr 2, 2024):

Only sponsors can create frs.

<!-- gh-comment-id:2031241143 --> @KelvinTegelaar commented on GitHub (Apr 2, 2024): Only sponsors can create frs.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/CIPP#1175
No description provided.