Came across a useful script for an age old problem in SharePoint. May work on versions beyond 2013, but haven’t tested. Posting here for future reference (Found here: https://ehikioya.com/sharepoint-access-requests-powershell/):
$WebAppURL ="http://your-web-application-url.com/"
#Get a collection of all websites
$WebsColl = Get-SPWebApplication $WebAppURL | Get-SPSite -Limit All | Get-SPWeb -Limit All
ForEach ($web in $WebsColl)
{
# Only run this if access requests are currently enabled AND if the website does NOT inherit permissions
if($web.RequestAccessEnabled -and $web.Permissions.Inherited -eq $false)
{
# Disable access request
$web.RequestAccessEmail = ""
$web.Update()
write-host "Access request disabled for website: " $web.URL
}
}
Leave a Reply