Disable Access Requests – SharePoint 2013

If you migrate from MOSS 2007 or SharePoint 2010 to SharePoint 2013, the access requests are enabled by default and are set to the email for the primary site collection administrator.

It can be a good thing if you want your end users to request access as needed but if you have more than 300 site collections which are centrally managed by a team of administrators managing thousands of users. It soon becomes a nightmare.

To avoid such scenarios, you can disable the Access Requests by a quick powershell script on the web application.

Below script sets the Access Request Email as none which inherently sets the “RequestAccessEnabled” to false.

There is no direct way to set this flag as it is exposed as a read only property.

$spsites = get-spsite -WebApplication  -Limit All
foreach($spsite in $spsites)
{
    foreach($SPweb in $spsite.AllWebs)
    {
        # if a site inherits permissions, then the Access request mail setting also will be inherited
        if (!$SPweb.HasUniquePerm)
        {
            Write-Host "Inheriting from Parent site";
        }   
        elseif($SPweb.RequestAccessEnabled)
        {
            $SPweb.RequestAccessEmail = "";
	    $SPweb.Update();
        }
    }
}