|
A common mistake is to follow the OOTB permissions for each site and add everyone to the Owners group which gives them Full Control. Often, after the fact you wish to downscale the Owners groups littered throughout your site collection from Full Control to Contribute or even Read (until the Owners have had their SharePoint training). The PowerShell script below does exactly this by recursively going to each Site (SPWeb) and finding teh groups with the name containing "Owner" and replacing that group with "Full Permission" to "Read" (in this example of the method call) : Unknown macro: {NewCode}
$webappUrl = "http://sitecollectionurl"; Clear-Host Unknown macro: {env}
\Microsoft Shared\web server extensions\12\" function get-spweb ([String]$webUrl=$(throw 'Parameter -webUrl is missing!')) if ($web.HasUniqueRoleAssignments) #If it is a group then check for users within the group Unknown macro: { Write-Host "Role Definitions within principal" $principal.Name; $roleAssignment.RoleDefinitionBindings.Remove($roleDef); $roleAssignment.RoleDefinitionBindings.Add($web.RoleDefinitions[$newRole]); }
} if ($web.Webs.Count -ne 0) Unknown macro: { get-spwebInfo($subweb); $subweb.Dispose(); }
} function sproledefinition-exists ([Microsoft.SharePoint.SPWeb]$web, [string]$roleName) Unknown macro: { $exists = $true; }
} $devWeb = get-spweb $webappUrl change-permission $devWeb "Full Control" "Read" "Owners" External References
Labels |






