I have a few users that have non-standard permissions for OneDrive for Business . I've found a PowerShell Script that will list all OneDrives but not the permissions.
Is there a way given a site, to list the permission using PowerShell?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityOkay its a little hard since there are so many it depends. Like on lists with unique permissions within the site and so on. however this code will get you the core of what you asked for. Try it out and let me know if it works for you.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$web = get-spweb "https://yourweb"
$roleAssignments = $web.RoleAssignments
foreach ($oRoleAssignment in $roleAssignments)
{
write-host $oRoleAssignment.member
foreach ( $binding in $oRoleAssignment.RoleDefinitionBindings )
{
write-host $binding.name
}
}
You can get very deep with permissions and powershell, if you want to know more look at the RoleDefinitionBindings Class on MSDN.