Skip to main content

Enable Custom Scripts in SharePoint Sites

How to enable or disable custom scripts for specific SharePoint sites.

Scripting for SharePoint sites can be enabled or disabled at the tenant level. It is recommended to leave it off and only enable scripting for specific sites that require it.

Scripting can be enabled for a specific site collection using PowerShell. [1]

Set-SPOSite <SiteURL> -DenyAddAndCustomizePages 0

or, if using PnP.PowerShell:

Set-PnPSite -Identity <SiteURL> -NoScriptSite $false

If you change this setting for a classic team site, it will be overridden by the Custom Script setting in the admin center within 24 hours.


  1. Allow or prevent custom script - SharePoint in Microsoft 365 | Microsoft Learn↩︎
Updated on Jul 27, 2025