How to look out for empty user groups using Powershell in SharePoint 2010,2013,2016,2019?

Hello SharePointers,

Below are the powershell script to look out for empty user groups using Powershell in SharePoint 2010,2013,2016,2019.

 

if (!(Get-PSSnapin Microsoft.Sharepoint.Powershell -ErrorAction SilentlyContinue))
{ Add-PSSnapin microsoft.sharepoint.powershell }

$site = “Your sharepoint site name”

$UsergroupCount = get-spsite $site | % {
$_.allwebs | % {
$web = $_
$web.groups | % {
[pscustomobject][ordered]@{
“GroupName” = $_.name
“WebName” = $web.Name
“UserCount” = $web.users.count
“Permissions” = ($web.roles | select -ExpandProperty name) -join “,”
}
}
}
}

$UsergroupCount

Happy SharePointing folks !!

Leave a Reply

Your email address will not be published. Required fields are marked *