Update RequestAccessEmail with PowerShell

Update: I have an improved version of this at:  Replace-RequestAccessEmail

I sometimes forget to change the Request Access Email from using my account to the group admin distribution email. This helps correct that:

$webapp = Get-SPWebApplication "https://WEBAPP"
foreach($site in $webapp.Sites){
     foreach($web in $site.AllWebs){
         if ($web.HasUniqueRoleDefinitions){
                 Write-Host $Web.URL
                 Write-Host $Web.RequestAccessEmail
                 Write-Host "---"
                 if ($web.RequestAccessEmail -eq 'my.email@email.com'){
                     Write-Host $Web.URL "Update RequestAccessEmail"
                     Write-Host "---"
                     $web.RequestAccessEmail ="SPADMIN.GROUP@email.com"
             else {
                 Write-Host "Access Request Settings not enabled." $Web.URL

One Response to Update RequestAccessEmail with PowerShell

  1. I think you need to use $web.HasUniqueRoleAssignments instead of role definitions.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: