I have written a set of PowerShell code to enable scripting on a site collection. Now, what is the possible way to check the current status of Scripting. Can anyone please provide me a PowerShell code?

$Url = "https://domain.sharepoint.com/"
$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential



Set-SPOsite $Url -DenyAddAndCustomizePages 0

The above is the code which I have written for enabling scripting in SharePoint O365 site.


You need to run the below command :

$Url = "https://domain.sharepoint.com/"
Get-SPOSite -Identity $Url -Detailed | select DenyAddAndCustomizePages

It will give you the scripting status. It will be set as Enabled for Modern team and communication sites. For classic sites, the status will show Disabled after you have run the commands mentioned in the question .

enter image description here

| improve this answer | |
  • Hi Gautam, thank you for your response. Can you please let me know if the code which I have used to Enable scripting is correct? Because I am getting the value as "Disabled". – Anand Nov 8 '17 at 15:53
  • Yes, its correct. It will enable custom scripts on your site collection. – Gautam Sheth Nov 8 '17 at 15:55
  • It didn't work for me though. :'( ibb.co/bJctnb – Anand Nov 8 '17 at 15:58
  • I think it worked, its showing up Disabled which is expected. Now custom scripts are enabled on your site collection. To verify , go to site settings. Under the Web Designer Galleries section, Solutions link will show up. – Gautam Sheth Nov 8 '17 at 16:00
  • Thanks a lot. "Solutions" link is present at the same location. Can you please tell me why is it "Expected"? And any links where I can see the changes comes after enabling scripting? – Anand Nov 8 '17 at 16:09

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.