Good morning all.
I have a dilemma - our SP tenant has been set with UK region, but with US locale. and this causes problems with American date formats etc.
I have run the following PS script (thanks Michael Han_MSFT) to change all sites' locale to UK:
$LocaleId = 2057 # UK
$TimeZoneId = 2 # London
$credentials = Get-Credential
Connect-PnPOnline https://tenant.sharepoint.com/sites/yoursite -Credentials $credentials
$sites=Get-PnPTenantSite
foreach($site in $sites){
Connect-PnPOnline $site.Url -Credentials $credentials
$web = Get-PnPWeb -Includes RegionalSettings,RegionalSettings.TimeZones
$timeZone = $web.RegionalSettings.TimeZones | Where-Object {$_.Id -eq $TimeZoneId}
$web.RegionalSettings.LocaleId = $LocaleId
$web.RegionalSettings.TimeZone = $timeZone
$web.Update()
Invoke-PnPQuery
}
The script did the job for SP sites, but all OneDrive sites came as "Access Denied" because of unique permissions.
So I was thinking to add the account running the script as secondary admin to OneDrive sites, run the above script and remove the account at the end of the script and leave the original permissions to sites.
Adding something as:
#Store 2nd Admin account into a variable
$adminAcctToAdd = "[email protected]"
#Add 2nd Site Collection admin
Set-SPOUser -Site $url.PersonalUrl -LoginName $adminAcctToAdd -IsSiteCollectionAdmin $true
Run the above locale change script and at the end remove the secondary admin:
Set-SPOUser -Site $url.PersonalUrl -LoginName $adminAcctToRemove -IsSiteCollectionAdmin $false
Any help how to bolt that together?
Much appreciated! Best!