Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

HasUniqueRoleAssignments fails in some cases

$
0
0

This is the code

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | Out-Null
cls
$web1 = Get-SPWeb -identity http://siteurl/personal/dom_user1/
$web2 = Get-SPWeb -identity http://siteurl/personal/dom_user2/
$lists1 = $web1.Lists
$lists2 = $web2.Lists
Write-Host "Lists for user1"
foreach($list in $lists1)
{
 Write-Host "$($list.Title) -  $($list.DefaultViewUrl)" 
 if(($list.BaseType -eq "DocumentLibrary") -and  ($list.DefaultViewUrl -match "/Personal Documents/"))
    {
  Write-Host "Found Personal docs folder! Check Unique permissions..."
  Write-Host $list.HasUniqueRoleAssignments  
 } 
 Write-Host ""
 Write-Host ""
}
Write-Host "Lists for user2"
foreach($list in $lists2)
{
 Write-Host "$($list.Title) -  $($list.DefaultViewUrl)" 
 if(($list.BaseType -eq "DocumentLibrary") -and  ($list.DefaultViewUrl -match "/Personal Documents/"))
    {
  Write-Host "Found Personal docs folder! Check Unique permissions..."
  Write-Host $list.HasUniqueRoleAssignments  
 } 
 Write-Host ""
 Write-Host ""
}

In both cases, the users have their "Personal Documents" folder with InHerite perissions. For one user, it says correctly that it doesn't have Unique Role Assignments, and for the other one it says it does.

The user running the script is a central admin account.

Is there a particualr issue that makes the .HasUniqueRoleAssignments return incorrect information?

Something else I can verify?

This is a script supposed to run peridically and if I cant trust on that property the whole script lacks of sense...

Thank you for any help!!


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>