I am trying to update placeholder text of a search box using Set-PnPSearchSettings -Scope Site -SearchBoxPlaceholderText "My search" but it is giving me ServerUnauthorizedAccessExceptionaccess: access is denied error for certain sites. I have a hub and this seem to worked on the hub site but when I try to run this on associated hub sites I get this error. But on a different tenant I can run this with no problem on both hub site and associated hub sites. I am a site collection administrator for all of the sites. I am on SharePoint Online

1 Answer 1


Run following pnp powershell to check if the custom script for this site has been enabled, which will make some features unavailable:

$cred = Get-Credential -UserName $UserName -Message "Please enter password for $UserName"
Connect-PnPOnline -Url $SiteUrl -Credentials $cred
Get-PnPTenantSite -Url $SiteURL |select DenyAddAndCustomizePages

To allow custom script on a particular site:

Set-PnPSite -Url $SiteURL -NoScriptSite $false

enter image description here

  • Thanks, @Julie_MSFT
    – hellothere
    Nov 20, 2021 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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