Forum Discussion
Christophe Humbert
Dec 27, 2017Iron Contributor
Get Site Permissions with PnP PowerShell
How can I retrieve site permissions on a site or subsite using PnP PowerShell?
Example: https://$orgName.sharepoint.com/sites/IT/Atlas
Via the UI: Site settings > Site Permissions
W...
- Jan 04, 2018The following worked for me:
$cred = get-credential
Connect-PnPOnline -Url "https://$orgname.sharepoint.com" -Credentials $cred
$web = Get-PnPWeb -Includes RoleAssignments
foreach($ra in $web.RoleAssignments) {
$member = $ra.Member
$loginName = get-pnpproperty -ClientObject $member -Property LoginName
$rolebindings = get-pnpproperty -ClientObject $ra -Property RoleDefinitionBindings
write-host "$($loginName) - $($rolebindings.Name)"
write-host
}
satendraprasad
Feb 12, 2020Copper Contributor
Hey ,
I am new to it and can you please explain how to i export this to csv file using powershell.
René Modery
Feb 12, 2020MVP
satendraprasad , I don't have any working code, but the snippets in this post together with the Select (Select-Object) (-Property to only choose some properties) and Export-Csv cmdlets would work:
- satendraprasadFeb 13, 2020Copper Contributor
Hi René Modery ,
Thank You very much .