by

How To Disable SharePoint Designer on SharePoint 2010 Programmatically

Here's a little PowerShell script to disable users from using SharePoint Designer 2007 on your SharePoint 2010 sites. It is not really a complicated matter like it was during the SharePoint 2007; the only thing to note here are 3 main points:
  • you must have access to the namespace Microsoft.SharePoint.Client
  • you MUST run this script with at least Admin permissions for the Site Collection in question
  • The functionality to enable and disable this must have been set during the site collection creation. By default it is NOT. You can check that on the Site Collection properties.
Failing to attend these 2 conditions will throw you back an exception.

function Lock-SharePoint-Designer-Use([string]$url)
{
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null
    $rootSite = new-object Microsoft.SharePoint.SPSite($url)
 
    if($rootSite.RootWeb.AllowDesignerForCurrentUser -eq "true")
    {
        $rootSite.AllowDesigner = false
        write-output "site "$($rootSite.RootWeb.Title)) "locked for SharePoint designer"
    }
    else
    {
        write-output "site "$($rootSite.RootWeb.Title)) "does not allow designer to be configured for this site collection"
    }
 
}

Additionally you can also try other configurations to increase the lockdown surface for nasty actions that can be accomplished by some users, such as :
$rootSite.AllowRevertFromTemplate
$rootSite.AllowMasterPageEditing
$rootSite.AllowShowUrlStructure

See you later,

By

No comments:

Post a Comment