Manage Item permission Via powershell

Hi

I need add read permission for all authenticated users in the list item. The list item are in unique level permission. how can i add the read permission for all the item using powe

July 8th, 2013 3:35am

Hi,

Using power shell loop through all the items in your library and then add domain\ntauthenticated users group to each of the item with read permission level

Free Windows Admin Tool Kit Click here and download it now
July 8th, 2013 3:41am

Hi,

Below code will add "Contribution" permission to a list, you can use it with a little customization.

# Alter Item-Level Permission settings and assign "Contribute" role definition to the visitors group
# (c) 2011 Morgan de Jonge
 
# Specify the name of the visitors SharePoint group
$visitorsSPGroupName = "Example Site Visitors"
 
$spSite = Get-SPSite "http://portal.contoso.com"
# We'll assume the list is in the top-level site in the site collection
$spWeb = $spSite | Get-SPWeb
# Look up the list named "Questions"
$questionsList = $spWeb.Lists["Questions"]
 
# Set the Read access Item-level permissions settings to "Read items that were created by the user"
$questionsList.ReadSecurity = 2
# Set the Create and Edit access Item-level permissions to "Create items and edit items that were created by the user
$questionsList.WriteSecurity = 2
 
# Assign the "Contribute" RoleDefition to the site's visitors group
$visitorsSPGroup = $spWeb.Groups[$visitorsSPGroupName]
$questionsList.BreakRoleInheritance($true)
$assignment = New-Object Microsoft.SharePoint.SPRoleAssignment($visitorsSPGroup)
# Assuming this is a default site, we'll look for a role definition of the type "Contributer".
# This way, the script will also work with SharePoint sites created in languages besides English.
$assignment.RoleDefinitionBindings.Add(($spWeb.RoleDefinitions | Where-Object { $_.Type -eq "Contributor" }))
$questionsList.RoleAssignments.Add($assignment)
 
$questionsList.Update()
 
$spWeb.Dispose()
$spSite.Dispose()

Thanks,

Kenon Yin

July 8th, 2013 6:49am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics