I am trying to use PowerShell to update the permission of groups in my sites, and I am using this script.
$ver = $host | select version if($Ver.version.major -gt 1) {$Host.Runspace.ThreadOptions = "ReuseThread"} if(!(Get-PSSnapin Microsoft.SharePoint.PowerShell -ea 0)) { Write-Progress -Activity "Loading Modules" -Status "Loading Microsoft.SharePoint.PowerShell" Add-PSSnapin Microsoft.SharePoint.PowerShell } $web = Get-SPWeb http://theSite $group = $web.Groups["GroupOne Members"] $role = $web.RoleDefinitions["Read"] $RoleAssignment = New-Object Microsoft.SharePoint.SPRoleAssignment($group) $RoleAssignment.RoleDefinitionBindings.Add($role) $web.RoleAssignments.Add($RoleAssignment) $web.Update() $web.Dispose()
When I ran my script the first time and it worked just fine, however I am not getting the "Aconstructor was not found. Cannot find an appropriate constructor for type Microsoft.SharePoint.SPRoleAssignment." error when I run the same script for subsequent sites. I don't understand why it worked the first time, but won't work now...anyone ever run into this?