Get Group Users From SharePoint Site Using PnP Powershell

In this blog, we are going to see how to get the list of available groups and users from SharePoint site using PnP PowerShell.
 
The below PowerShell command retrieves all the SharePoint Groups from the SharePoint site and its users with users count for the group.
 
Get-PnPGroup PnP PowerShell cmdlet gets the SharePoint Groups from the SharePoint site collection.
  1. PS:> $cred = Get-Credential  
  2. PS:> Connect-PnPOnline -Url https://<tenant>.sharepoint.com/sites/dev -Credential $cred  
  3. PS:> $groups = Get-PnPGroup | Select-Object Title,Users  
  4. PS:> $groups | format-table @{Expression = {$_.Title};Label='Group'},@{Expression = {$_.Users.Title};Label='Users'},@{Expression = {$_.Users.Count};Label='UsersCount'}  
Output