List All SharePoint Site Request Access Emails In A Web Application

When a SharePoint site is created, by default the creator’s email address is automatically populated into the “Manage Access Requests”. However, sometimes the creator isn’t the site owner, and doesn’t handle the day-to-day access requests for the site.

The script below will go through all sites and site collections within a designated web application and list the site title, url, and Access Request email.

If you’d like to spit out an inventory CSV file with the URL and number of characters, just use the Out-File Cmdlet:

FindAccessEmail | Out-File -filepath C:\wherever\AccessRequestEmails.csv
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
 
#Starting web app
$site = "http://sharepoint.company.com"
 
# Function: FindAccessEmail
# Description: Go through a target web application and list the title, url and access request email.
function FindAccessEmail
{
	$WebApps = Get-SPWebApplication($site)
	foreach($WebApplication in $WebApps)
	{
	    foreach ($Collection in $WebApplication.Sites)
	    {
	       foreach($Web in $Collection.AllWebs)
	        {
				$siteDetails = $Web.title+'#'+$Web.url+'#'+$Web.RequestAccessEmail 
	            write-host $siteDetails
				Write-Output $siteDetails
	        }
	    }
	  }
}
#Run Script!
FindAccessEmail