Skip to content

Instantly share code, notes, and snippets.

@rheid
Created August 31, 2018 09:15
Show Gist options
  • Save rheid/205f14a96cbd093653d4ebada47153b0 to your computer and use it in GitHub Desktop.
Save rheid/205f14a96cbd093653d4ebada47153b0 to your computer and use it in GitHub Desktop.
Update SharePoint RequestAccessEmail
$webapp = Get-SPWebApplication "https://WEBAPP"
foreach($site in $webapp.Sites){
foreach($web in $site.AllWebs){
if ($web.HasUniqueRoleDefinitions){
if($web.RequestAccessEnabled){
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"
$web.Update()
}
}
else {
Write-Host "Access Request Settings not enabled." $Web.URL
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment