Friday 1 November 2013

SharePoint 2010: Configure access request settings using Powershell


# Get All Web Application
$webApp=Get-SPWebApplication
   # Get All site collections
    foreach ($SPsite in $webApp.Sites)
    {
       # get the collection of webs
       foreach($SPweb in $SPsite.AllWebs)
        {
              # if a site inherits permissions, then the Access request mail setting also will be inherited
             if (!$SPweb.HasUniquePerm)
               {
                  Write-Host $SPweb.Name "Inheriting from Parent site"
               }
             elseif($SPweb.RequestAccessEnabled)
           {
        #Write-Host $SPweb.Name "Not Iheriting from Parent Site"
              $SPweb.RequestAccessEmail ="ram001@sample.com"
          $SPweb.Update()
           }
        }
    }

****** HAPPY CODING ********

No comments: