1

We have a huge SharePoint environment and not every Owner's group or admin group have full control on their site. I am looking to see if someone already made a script to show which group in the farm in all site have full control to their site for example

siteurl, groupname

thanks for any help.

0

Here below is the PowerShell script to get all SharePoint user groups which has Full Control permission in sites for all web applications from server.

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$permissionName = "Full Control";
Write-Host "Name of groups which has" $permissionName " permission in sites from all web applications:"
$webApps = Get-SPWebApplication
foreach ($webApp in $webApps)
{
    Write-Host -ForegroundColor Gray "Web application: "$webApp.Name
    $sites = get-spsite $webApp.Url
    foreach ($site in $sites)
    {
        write-host -foregroundcolor green "Site Collection: "$site.RootWeb.Title
        foreach ($web in $site.AllWebs) 
        {
             write-host -foregroundcolor green "Web: "$web.Title
             foreach($roleAssignment in $web.RoleAssignments)
             {
                foreach($roleDefinition in $roleAssignment.RoleDefinitionBindings)
                {
                    if($roleDefinition.Name.ToString() -eq $permissionName)
                    {
                    write-host -foregroundcolor Cyan "Group Name: "$roleAssignment.Member.Name
                    break;
                    }
                }
            }
            $web.Dispose()
        }
        $site.Dispose()      
    }
}
  • Thanks this pointed me in the right direction. I added an export-csv to it and all set. cheers – Breau Feb 10 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.