Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 34890

Setting Access Request for SharePoint 2013/2016

$
0
0

Hey Guys,

Took a quick look and figured how to set Access Request for all Site Collections, the script is provided AS-IS and should be considered a sample.

While I have some error checking and extra logic in there you will probably want to add your own in there.

Add-PSSnapin Microsoft.SharePoint.PowerShell
$DefaultEmail = "admin@weaver.ad"
Get-SPSite | ForEach-object {
    $OwnerEmail = $null
    $OwnerEmail = $_.Owner.Email
    if($OwnerEmail -eq $null)
    {
        $OwnerEmail = $DefaultEmail
    }
    $_.AllWebs | ForEach-Object {
        if(!$_.RequestAccessEnabled)
        {
            $_.RequestAccessEmail = $OwnerEmail
        }
    }
} 
Pax

Viewing all articles
Browse latest Browse all 34890

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>