I know Central Admin can be controlled using PowerShell mostly if not all. What I'm trying to figure out is if there's a way to enable/disable the creation of subsites in Central Admin using a PowerShell script.

enter image description here

2 Answers 2

$webApp = Get-SPWebApplication -Identity http://mywebapp
$allowSubsites = $false

if ($allowSubsites){
    $newPermissions=[Microsoft.SharePoint.SPBasePermissions]($webApp.RightsMask -bor [Microsoft.SharePoint.SPBasePermissions]::ManageSubWebs)
    $newPermissions=[Microsoft.SharePoint.SPBasePermissions]($webApp.RightsMask -band [System.Int64](-bnot ([Microsoft.SharePoint.SPBasePermissions]::EmptyMask -bor [Microsoft.SharePoint.SPBasePermissions]::ManageSubWebs)))

$webApp.RightsMask = $newPermissions

Reference: https://stackoverflow.com/questions/18986946/programmatically-access-user-permissions-for-web-application-in-sharepoint-2010

  • Does this work with SharePoint 2013? Im getting this error message: Cannot convert value "18446744073701163007" to type "System.Int64". Error: "Value was either too large or too small for an Int64."
    – Vader
    Commented May 31, 2018 at 22:04

Use below:

$webApp = Get-SPWebApplication "WEBAPPURL"
$newPermissions=[Microsoft.SharePoint.SPBasePermissions]($webApp.RightsMask - 
band [System.Int64](-bnot ([Microsoft.SharePoint.SPBasePermissions]::EmptyMask -bor [Microsoft.SharePoint.SPBasePermissions]::ManageSubWebs)))
$webApp.RightsMask = $newPermissions

Executing these lines will automatically remove the “Create Subsite” permission from your web application, thus prevent any users from ever creating subsite.

Refer below for more details: http://nikcharlebois.com/prevent-subsite-creation-in-sharepoint-using-powershell/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.