SharePoint site permissions. On going powershell project to breakdown a sharepoint site collection and all the permissions on all the parts to see who has permissions to what.
Add-PsSnapin Microsoft.SharePoint.PowerShell
Set-location $home
$topSite = Get-SPSite http://portal.opwftg.com/sites/OPWSS
"" | Out-File "C:\temp\UsersRoles.txt"
foreach($s in $topSite.AllWebs)
{
if($s.HasUniquePerm -eq "True")
{
if($s.URL -eq 'http://portal.opwftg.com/sites/OPWSS/Teams/OPCO/OES'){
"Site URL:" + $s.URL
"Site Title: " + $s.Title #| Out-File "C:\temp\UsersRoles.txt" -append
"`n"
"Site Groups"
"*************************"
#$s.Users #| Format-Table -Property UserLogin, DisplayName | Out-File "C:\temp\UsersRoles.txt" -append
$s.RoleAssignments | Format-Table -AutoSize -Property Member, RoleDefinitionBindings | Out-File "C:\temp\UsersRoles.txt" -Append
$groups = $s.Groups
foreach ($grp in $groups) {"Group: " + $grp.name; foreach ($user in $grp.users) {" User: " + $user.name} }
"Users at the website level"
"**************************"
$s.Users
foreach($u in $s.Users){
$u.DisplayName
$u.Roles
}
"`n"
"Lists and Libraries with Unique Permissions"
"*******************************************"
foreach($l in $s.Lists)
{
if($l.HasUniqueRoleAssignments -eq $true)
{
"*************************"
"List: " + $l.Title
"List Groups and individual Assignments"
"*************************"
##$l.RoleAssignments
"Role Assignments:"
foreach($r in $l.RoleAssignments){
"Member Name: " + $r.Member.Name
foreach($role in $r.RoleDefinitionBindings){
"Role Name: " + $role.Name
}
"`r"
}
}
}
}
}
}