I have several old groups in my site collection and would like to generate a report of the libraries, lists and pages that are using a specific group.

1 Answer 1


Have a try to below PowerShell commands:

Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"

Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
#Variables for Processing
$SiteUrl = "https://tenantname.sharepoint.com/sites/sitename"
$Password ="password"

#Setup Credentials to connect

$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,(ConvertTo-SecureString $Password -AsPlainText -Force))

$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl) 

$Context.Credentials = $credentials

#sharepoint online powershell get all lists

$Lists = $Context.web.Lists



#Iterate through each list in a site   

ForEach($List in $Lists)

    Foreach($RoleAssignment in $List.RoleAssignments)


           If($RoleAssignment.Member.PrincipalType -eq "SharePointGroup" -And $RoleAssignment.Member.LoginName -eq "TestGroup"){

                Write-host $List.Title "has TestGroup Group"

  • Thanks for the response. I'll give it a try!
    – MGreenia
    Dec 2, 2021 at 13:12
  • Would above commands be helpful to you? Comment here if you still need any help.
    – Allen_MSFT
    Dec 10, 2021 at 7:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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