Monday, 7 March 2016

PowerShell and SharePoint with SPUser for each list

#Reading the Web Url
$spWeb= Get-SPWeb -Identity "http://intranet.contoso.com/sites/contoso/Departments/Finance"
if($spWeb -eq $null) {    
Write-Host "The site URL is not valid"
}
#Reading all the lists
$spLists = $spWeb.Lists;
if($spLists -eq $null) {   
 Write-Host "The site has no lists."
} foreach($list in $spLists)
{    
$title = ($list).Title;   
 $listUrl = ($list).ParentWebUrl;    
Write-Host "Listing Permissions for List $title in $listUrl"    
($list).Permissions | select member -Unique|sort member
}

No comments:

Post a Comment