Posts
#Parameters $tenantUrl = Read-Host -Prompt "Enter tenant collection URL"; $dateTime = (Get-Date).toString("dd-MM-yyyy-hh-ss") $invocation = (Get-Variable MyInvocation).Value $directorypath = Split-Path $invocation.MyCommand.Path $fileName = "EffectivePermissionsReport-" + $dateTime + ".csv" $ReportOutput = $directorypath + "\Logs\"+ $fileName $userName = "i:0#.f|membership|steve.moon@ppf.co.uk" #Connect to PnP Online Connect-PnPOnline -Url $tenantUrl -Interactive $global:Results = @(); function GetUserEffectivePermissions($_ctx,$_object,$_userName,$_type,$_siteUrl,$_listUrl) { $user = get-pnpuser -Identity $_userName # Retrieve the user permissions on the site if($user){ $permissions = $_object.GetUserEffectivePermissions($user.LoginName) $_ctx.ExecuteQuery() #get all base permissions granted to the user $PermissionKindObj= New-Object Microsoft.