Advertisement
private775

PS/SP - add a group - read prmissions to all items

Jun 3rd, 2016
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $wUrl  = "http://contoso/sites/ITS"
  2. $w = Get-SPWeb $wUrl
  3. $l = $w.Lists["Accomplishments"]
  4. $gr = $w.Groups["Accomplishments Viewers"]
  5. $readRole = $w.RoleDefinitions["Read"]
  6. $ra = new-object -TypeName "Microsoft.SharePoint.SPRoleAssignment" -ArgumentLis $gr
  7. $ra.RoleDefinitionBindings.Add($readRole)
  8.  
  9. Write-Host -NoNewLine "Start "
  10. $l.Items | % {
  11.     $_.RoleAssignments.Add($ra)
  12.     $_.SystemUpdate($false)
  13.     Write-Host -NoNewLine "."
  14. }
  15.  
  16. Write-Host " done"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement