Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device.
Atlassian cookies and tracking notice, (opens new window)
Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
🔍 Discover Our Product Documentation

Barracuda Cloud Backup
Results will update as you type.
  • Release Notes
  • Exchange Web Services (EWS) Deprecation and Barracuda Cloud-to-Cloud Backup
  • Getting Started
  • How Barracuda Cloud-to-Cloud Backup Can Protect You from Ransomware
  • Understanding What Data is Backed Up
  • License Definitions
  • Expired Subscriptions
  • Offboarding Guide for Cloud-to-Cloud Backup
  • How to Activate Cloud-to-Cloud Backup
  • Available Locations
  • Understanding Barracuda Cloud-to-Cloud Backup Permissions for Microsoft 365
  • How to Add a Connection
  • How to Reauthorize a Connection
  • How to Configure Your Data Source
  • How to Configure Retention Policies
  • How to Back Up and Restore Your Data
  • Dashboard
  • Backup Page
  • Restore Page
  • Activities Page
  • Reports Page
  • Settings Page
  • Advanced Configuration
    • How to Configure EWS Throttle Policy Limits
    • How to Enable Custom Script for SharePoint
    • Understanding Throttling
  • Troubleshooting

    You‘re viewing this with anonymous access, so some content might be blocked.
    /
    How to Enable Custom Script for SharePoint
    Published Jan 07

    How to Enable Custom Script for SharePoint

    Jan 07, 2026
    Subscribe

    For SharePoint sites, custom script can be used to customize the look, feel, and behavior of web pages and sites according to your requirements. By default, custom script is only allowed on sites created by SharePoint admins but blocked on user-created sites. If custom script is blocked, you may see the error Custom Scripts are not enabled when trying to restore your data. 

    To resolve the error, use the SharePoint Online Management Shell, a tool containing a Windows Powershell, to enable custom script for the site(s) you are trying to restore data from. Note that this process may not work for all sites.

    You do not need to enable custom script for all sites. A best practice is to allow custom script only for the specific site(s) you are restoring, and then disable custom script after the restore is complete. Note: This change will not apply retroactively to sites created prior to this point. 

    Before you enable custom script, review the security considerations from Microsoft here https://learn.microsoft.com/en-us/sharepoint/security-considerations-of-allowing-custom-script. 

    Prerequisite

    Download the latest SharePoint Online Management Shell at https://www.microsoft.com/en-US/download/details.aspx?id=35588. 

    For more information on how to install and connect, see the following article from Microsoft https://learn.microsoft.com/en-us/powershell/sharepoint/sharepoint-online/connect-sharepoint-online.

    Enable Custom Script

    1. Open the SharePoint Online Management Shell. 

    2. Connect to SharePoint Online Management Shell by running the following command:

      Connect-SPOService -Url https://<your-domain>-admin.sharepoint.com

      You will be prompted to sign in as an administrator for the domain.

    3. Verify that the site you are trying to restore is in the site list by running the following command. Take note of the site you want to enable custom script for.

      Get-SPOSite

      You should see something similar to this site list:

    4. Check if custom script is currently enabled by running this command:

      Get-SPOsite -Identity https://<your-domain>.sharepoint.com/sites/<site-name> | select DenyAddAndCustomizePages

      In this example, the site work does not have custom script enabled. To enable custom script, DenyAddAndCustomizePages should be disabled. 

    5. To enable custom script, run the following command to set the DenyAddAndCustomizePages value to 0 (0=disabled, 1=enabled):

      Set-SPOSite https://<your-domain>.sharepoint.com/sites/<site-name> -DenyAddAndCustomizePages 0

      Note that there is no output from this command.

    6. Verify that custom script is enabled by running this command:

      Get-SPOSite -Identity https://<your-domain>.sharepoint.com/sites/<site-name> | select DenyAddAndCustomizePages

     


    We value your feedback.
    If you have questions, suggestions, or feedback on our documentation, contact the Campus Product Documentation team.
    For general product inquiries or technical support, please contact the global Barracuda Support team.

    {"serverDuration": 11, "requestCorrelationId": "4a0d43d786b74ed79a98cc35ff1b202c"}