0

I try to create a SharePoint group-based modern teamsite by powershell, but get an error. What I am doing wrong?

Connect-PnPOnline -ManagedIdentity -Url $adminCenterURL

New-PnPSite -Type TeamSite -Title "someName" -Alias "someName" -Owner $owners -Lcid 1043 -TimeZone UTCPLUS0100_AMSTERDAM_BERLIN_BERN_ROME_STOCKHOLM_VIENNA

ERROR: The remote server returned an error: (401) Unauthorized.

When I remove parameter -TimeZone it works fine.

1 Answer 1

0

When you create a new site, you need SharePoint admin permission. But when you want to set time zone of a site, you need permissions for this site. SharePoint admin does not mean has permissions for all sites.

So, first create a new site, then change the time zone of this site with enough permission.

1
  • But why they add parameter "TimeZone" to command "New-PnPSite"? I expect they build it and should work.
    – KEM
    Commented Mar 17 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.