none
NP - Powershell Script to Break Inheritance of All List Items

    Question

  • Hey All,

    I have a list with about 750 items. They are inheriting from the parent, and I would like to break inheritance and set the permission to a specific group, with full control. How can I do that?

    If anyone has a script handy, I'd greatly appreciate it!



    Monday, March 20, 2017 11:27 PM

All replies

  • Hi Marc,

    Here you go

    https://blog.sprider.org/2014/04/18/set-permission-to-list-items-using-powershell/

    http://morg.nl/2011/09/modifying-list-permissions-from-powershell/


    Please remember to click Mark as Answer on the answer if it helps you

    Monday, March 20, 2017 11:39 PM
  • thank you for those scripts. The second one just didnt work for me. The first one worked, but I also have a lot of items around 500 that are inheriting permissions. I need to break those. Once those are broken, I can use the first script.
    Tuesday, March 21, 2017 12:21 AM
  • Hi Marc,

    Try to use the PowerShell commands below to remove all items permission in a list:

    $url = "http://sp1gm" $listName = "list1"; $SPWeb = Get-SPWeb $url; $SPList = $SPWeb.Lists[$listName]; $SPItem = $SPList.GetItemById(1); #break inheritance if ($SPItem.HasUniqueRoleAssignments -eq $False) { $SPItem.BreakRoleInheritance($false) } #Remove all Permissions for ($i = 0; $i -lt $SPItem.RoleAssignments.Count; $i++) { try { $SPItem.RoleAssignments.Remove($i) } catch { } } $SPItem.Update()


    Best regards,

    Grace Wang


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Wednesday, March 29, 2017 10:36 AM
  • Hi

    when you break inheritance and you set a new permissions it can be will be applied by deafult to all items in that list

    When you chose to break inheritance , you can set to keep existing permissions or to remove them

    Let me know if you need more details


    Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.

    Wednesday, March 29, 2017 12:08 PM