Report for SharePoint Access Request Email Configurations
Requirement:
People are moving to different roles, Few left the company from time to time. Access requests are sent to those in that kind. Its a problem! We had to monitor the access request configurations to make sure its sent to the relevant person. So, Wrote this PowerShell code to generate the report for SharePoint access request email address configurations.
PowerShell to Generate Report on Access Requests Configuration:
Use this PowerShell script to get a list of all access request configurations:
and the Output:
Here is the MOSS 2007 Version to get access request Emails:
Related Posts:
People are moving to different roles, Few left the company from time to time. Access requests are sent to those in that kind. Its a problem! We had to monitor the access request configurations to make sure its sent to the relevant person. So, Wrote this PowerShell code to generate the report for SharePoint access request email address configurations.
PowerShell to Generate Report on Access Requests Configuration:
Use this PowerShell script to get a list of all access request configurations:
#Set-ExecutionPolicy RemoteSigned $OutputFN = "AccessRequestConfigs.csv" #delete the file, If already exist! if (Test-Path $OutputFN) { Remove-Item $OutputFN } #Write the CSV Headers "Site Collection Name, Site Name ,URL ,Access Requst E-Mail" > $OutputFN # Get All Web Applications $WebAppServices=Get-SPWebApplication foreach($webApp in $WebAppServices) { # Get All Site collections foreach ($SPsite in $webApp.Sites) { # get All Sites foreach($SPweb in $SPsite.AllWebs) { if($SPweb.RequestAccessEnabled -eq $True) { $SPsite.Rootweb.title + "," + $SPweb.title.replace(","," ") + "," + $SPweb.URL + "," + $SPweb.RequestAccessEmail >>$OutputFN } $SPweb.dispose() } $SPsite.dispose() } }
and the Output:
Here is the MOSS 2007 Version to get access request Emails:
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null #For SharePoint 2007 compatibility function global:Get-SPSite($url){ return new-Object Microsoft.SharePoint.SPSite($url) } #Get the web application Write-Host "Enter the Web Application URL:" $WebAppURL= Read-Host $SiteColletion = Get-SPSite($WebAppURL) $WebApp = $SiteColletion.WebApplication $OutputFN = "AccessRequestConfigs.csv" #delete the file, If already exist! if (Test-Path $OutputFN) { Remove-Item $OutputFN } #Write the CSV Headers "Site Collection Name, Site Name ,URL ,Access Requst E-Mail" > $OutputFN # Get All Site collections foreach ($SPsite in $webApp.Sites) { # get All Sites foreach($SPweb in $SPsite.AllWebs) { if($SPweb.RequestAccessEnabled -eq $True) { $SPsite.Rootweb.title + "`t" + $SPweb.title + "`t" + $SPweb.URL + "`t" + $SPweb.RequestAccessEmail >>$OutputFN } $SPweb.dispose() } $SPsite.dispose() }
Related Posts:
Can you send me the same for SharePoint 2007 ?
ReplyDeleteUpdated with the code for SharePoint 2007!
DeletePerfect! I had a support rep request this very thing, after finding this article I was able to send the info to him in less than 5 minutes. Much Thanks!
ReplyDeleteI tried to run it and get the following error:
ReplyDeleteE:\PSscripts\ShowInfo\AccessRequestReport.ps1 : Exception has been thrown by the target of an invocation.
Eric,
DeleteIt could be a permissions issue! Make sure you have permissions to that sites you are querying.
Use Try Catch to Debug the issue by printing the Exception, which should tell you the cause of the real problem! Make sure you are running the script with valid SharePoint URL and from a WFE.