SharePoint 2019 (and 2016) DenyAddAndCustomizePages

In SharePoint Online we are quite used to the fact that custom scripts are denied by default in SharePoint. You can allow custom scripts by using PowerShell ( Usually you realize this when you run into permission issues, missing libraries or features or migration errors.

It looks like Microsoft has added this same feature to SharePoint 2019 on-premise server also. We run into this issue while trying to migrate content from Office 365 to SharePoint 2019. Luckily you can also allow custom scripting in on-prem by running following PowerShell script.

$site = Get-SPSite -Identity ""
$site.DenyPermissionsMask = [Microsoft.SharePoint.SPBasePermissions]::EmptyMask

5 thoughts on “SharePoint 2019 (and 2016) DenyAddAndCustomizePages

    1. Sorry it took me so long to answer.

      If I create a new site, I noticed the denypermissionmask is already saying EmptyMask. Maybe the best way to ensure you can roll back is to save the default denypermissionmask to a variable like this:
      $site = Get-SPSite -Identity “”
      $defaultDenyPermissionMask = $site.DenyPermissionsMask
      $site.DenyPermissionsMask = [Microsoft.SharePoint.SPBasePermissions]::EmptyMask

      Now if you need to revert back to default, just run:
      $site.DenyPermissionsMask = $defaultDenyPermissionMask

Leave a Reply

Your email address will not be published. Required fields are marked *