Syntax

# Parameters 
$tenantId = Read-Host -Prompt “Enter Tenant ID” 
$clientId = Read-Host -Prompt “Enter Client ID” 
$clientSecret = Read-Host -Prompt “Enter Client Secret” 
$outputDirectory = Read-Host -Prompt “Enter Output Directory” 

Download Full Script

Purpose:Get details of all group membership for a user
Modification:
Type:PowerShell Script
Compatibility:PowerShell 
Tags:Belongs to O365
Reference link: