How to set timezone when creating sites using New-PnPSite
Domanda
I'm currently using this command to create new SharePoint modern communication sites:
New-PnPSite -Type CommunicationSite -Owner me@acme.com -SiteDesign Blank -Lcid 1044 -Title "My site" -Url https://acme.sharepoint.com/sites/my_site
I've yet to find how to set the timezone for new sites, as there doesn't seem to be no timezone
flag. Is there anything I'm missing here? How does others set timezone for new sites?
Soluzione
You could use use New-SPOSite to create new SharePoint modern communication sites with timezone:
New-SPOSite -Url https://acme.sharepoint.com/sites/my_site -Owner me@acme.com -Template "SITEPAGEPUBLISHING#0" -StorageQuota 2048 -Title "Communication" -TimeZoneId 13 -LocaleID 1044
References: https://www.sharepointdiary.com/2016/06/sharepoint-online-create-site-collection-using-powershell.html
https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/new-sposite?view=sharepoint-ps
Altri suggerimenti
Using PnP-PowerShell, you can do it like below:
$adminUrl = "https://<tenant>-admin.sharepoint.com"
$newSiteUrl = "https://<tenant>.sharepoint.com/sites/Pensaerniaeth"
$ownerEmail = "<your.name@your.email.com>"
$siteTitle = "Pensaerniaeth" # Translates to "Architecture" - Bing Translator
$siteTemplate = "SITEPAGEPUBLISHING#0" # Communication Site Template
$lcid = 1106 # Welsh (https://capa.ltd/mui-lcids)
$timeZone = 2 # London (https://capa.ltd/sp-timezones)
Connect-PnPOnline -Url $adminUrl -NoTelemetry
New-PnPTenantSite -Template $siteTemplate -Title $siteTitle -Url $newSiteUrl -Lcid $lcid -Owner $ownerEmail -TimeZone $timeZone
Reference:
Create Communication Sites with a specific primary language using PnP PowerShell.