You can add permission levels to a user or group in SharePoint 2010 using Windows PowerShell. First, store the permission level in a variable, next retrieve the user or group from the role assignments collection, and finally use the add() method to add a specific permission level. The example below demonstrates how to grant the members group full control on a Web site:
PS > $spWeb = Get-SPWeb http://SP01.powershell.nu
PS > $roleDefinition =
>> $spWeb.RoleDefinitions | Where-Object { $_.Name -eq "Full Control" }
PS C:\> $spWeb.RoleAssignments |
>> Where-Object { $_.Member -like "*Members" } | foreach {
>> $_.RoleDefinitionBindings.Add($roleDefinition)
>> $_.Update()
>> }
ReTweet this Tip!
Posted
Jul 04 2012, 06:00 AM
by
sos