In Sharepoint, I have a list with custom permissions:
I want to create a powershell script that can loop through the permissions, and get two things, 1 is the permission name, and the other is the name, weather it is a person or group.
I have this:
$lists = $spWeb.Lists | Where-Object {$_.Title.StartsWith('custom_')}
$listCount = $lists.Count
write-host ("Found {0} lists..." -f $listCount)
foreach ($list in $lists) {
$collRoleDefinitions = $list.RoleDefinitions;
$collRoleAssignments = $list.RoleAssignments;
#write-host $collRoleDefinitions
$assignments = $collRoleAssignments
foreach($role in $assignments) {
write-host $role
}
}
but I don't know how to get the permission name and user account. For the user account I think this might work
$role.Member;
but unsure about the permission name. Basically I want to get things like "Contribute" or "Full Control".
Does anyone know?
Thanks