I ran into a helpful PowerShell script today that I wanted share.

When creating SharePoint 2013 sites, by default (maybe it’s our default) the Allow access requests checkbox is enabled. (You can find this by going to Site Settings -> Site Permissions -> Access Request Settings.)

allowaccessrequests

The unfortunately issue with this, is when a user goes to your site, and submits an access request, the email may literally go to someone@example.com . I’d probably need to check with a mail person to see if there truly are requesting going to a @example.com domain or not. I do know for certainly though that the request never ends up in the hands of any actual person who can approve or reject the access request, which means the requestor waits and waits and finally emails someone directly frustrated that they followed the process and no one ever got back ahold of them. Therefore making the entire Access Request Process null and void. There’s was chaos, discord and rioting in the SharePoint streets! Well maybe not.

Another issue is sometimes when I’d migrate a site over to our Farm, it was use the name of the person running the migration as the email to “Send all access request to…”  This may be okay if it’s just a top level site, but when you have a top level SC, and 5-6 sub sites, which don’t inherit permissions, and then some of those sub sites may have sub sites, and well next thing you know you may be the new proud owner of access request for 9 or 10 sub sites that you really have no idea if a user really needs permissions to or not. Not to mention a pretty interesting array of user reasons for needing access.

accessrequestmessages

Anyways back to the fix, so I needed a way to quickly identify all of the email address’s listed for access requests on all of the sites in the web application. I ran across a great simple post by Nik Craik linked here. http://www.nikcraik.ca/list-all-site-request-access-emails-in-a-web-application/

His script will walk through your web application and list the site name, url, and email address (or lack thereof) for all of your sites. (Yes! sub sites are included).

I out put the inventory into a CSV file, then imported that data into Excel for some quick table manipulation and viola, a list of all the sites, where I’m listed as the Access Request emailer… person, basically I simply then had to visit those sites and put in the proper email address to handle those requests.
Thanks again Nik Craik for the great script.

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

#Starting web app
$site = “http://yourwebapp.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 | Out-File -filepath C:\Temp\reports\AccessRequestEmails.csv

(492)