Forum Discussion
Allow or prevent custom script at different scopes and levels
Thuyavan Ganesan wrote:
Please pardon my English :)
1. As a user if global admin & SP admin created site collection will have custom script enabled by default.
2. i think there is something unclear, you mentioned that the setting is applied to both admin and end users, then you said that by default custom scripting is allowed for admin.. so the setting will not be applied to the admin in this case??
Yes, if you are admin if you create a site collection your by default it set to "Enable" , later if you want you can disable
but if you are not an admin and if you create a site collection your by default it set to "Disabled". Later admin can enable it for you.
3. please use this
Set-SPOsite <SiteURL> -DenyAddAndCustomizePages 0
ok thanks a lot for your contentious help.
so let me summarize things, also to make it easier for other:-
1. if a sharepoint admin or global admin create a site collection, then it will have custom scripts enabled by default, for all users. and we can disabled it later on?
2. while if an end user (who is not a global admin nor is a sharepoint admin) creates a site collection , then custom script will be disabled by default, for all users. and we can enable it later on?
3. Now it is not clear what is the relation between setting on the SP admin and the default behavioure? let say i am disabling the custom script at the SP admin level, and a global admin create a new site collection,, will custom script be disable or enabled by default in this case?
4. Final question. now let say i run this script to enable "custom script" at the site collection level (for sites created by admin and by end users) Set-SPOsite <SiteURL> -DenyAddAndCustomizePages 0 , while i have custom script disabled at the SP admin level (for both personal sites & self-service site ), then will the SP admin settings override the setting on the site collection after 24 hours? because on the official Microsoft documentation they mentioned the following sentence ""If you change this setting for a user's OneDrive or a user-created site, it will be overridden by the Custom Script setting in the admin center within 24 hours." ?" so at the end all the site collections (created by admin or created by end users) will have the same setting as defined on the SP admin settings?
Thanks
1. if a sharepoint admin or global admin create a site collection, then it will have custom scripts enabled by default, for all users. and we can disabled it later on?
yes you are correct
2. while if an end user (who is not a global admin nor is a sharepoint admin) creates a site collection , then custom script will be disabled by default, for all users. and we can enable it later on?
Yes thats right
3. Now it is not clear what is the relation between setting on the SP admin and the default behavioure? let say i am disabling the custom script at the SP admin level, and a global admin create a new site collection,, will custom script be disable or enabled by default in this case?
you can disable custom script for only non admins at the SP admin level (there is no option for you to disable for admin but once a admin create a site collection there is an option at the site collection level to disable). only site collection level you can disable/ enable for both user and admin.
4. Final question. now let say i run this script to enable "custom script" at the site collection level (for sites created by admin and by end users) Set-SPOsite <SiteURL> -DenyAddAndCustomizePages 0 , while i have custom script disabled at the SP admin level (for both personal sites & self-service site ), then will the SP admin settings override the setting on the site collection after 24 hours? because on the official Microsoft documentation they mentioned the following sentence ""If you change this setting for a user's OneDrive or a user-created site, it will be overridden by the Custom Script setting in the admin center within 24 hours." ?" so at the end all the site collections (created by admin or created by end users) will have the same setting as defined on the SP admin settings?
Yes site collections (created by admin or created by end users) will have the same setting if its overridden by the Custom Script setting in the admin center