I have a SharePoint server where I built a site collection that contains many subsites inside.

I want to give a user a reader permission across whole site collection sub sites.

How to do it using a PowerShell script?

3 Answers 3


This script will ensure reader permissions to specified user across site collection.

Keep in mind: This is not the right way to deal with permissions issues!

$site = Get-SPSite -Identity "http://mysite/"
$user = Get-SPUser -Identity "mydomain\myuser" -Web $site.RootWeb
$assignment = New-Object Microsoft.SharePoint.SPRoleAssignment($user)
$role = $site.RootWeb.RoleDefinitions[[Microsoft.SharePoint.SPRoleType]::Reader]

foreach ($web in $site.AllWebs) {
    if ($web.HasUniquePerm) {

Note: You need to be Site Collection Admin to use this script.

This is just a quick demonstration and answer to your question but it is not solution to your problem. As I see you have some other issues with permissions settings.

  • 1
    $site.RootWeb.RoleDefinitions[[Microsoft.SharePoint.SPRoleType]::Reader] returns wrong definition (user ends up with Edit rights in my case. Use the following instead: $site.RootWeb.RoleDefinitions.GetByType([Microsoft.SharePoint.SPRoleType]::Reader)
    – mhbuur
    Sep 28, 2015 at 8:45

You could certainly do this via PowerShell, but you may not need to (...or want to). If the subsites inherit their permissions from their parent site and ultimately the site collection (...this is the default behavior) then you could simply add that user as a Reader to the site collection (root web) and be good to go.

  • my problem is that permission tools in main site => setting => permissions is disabled and i don't know why sharepoint.stackexchange.com/questions/16742/…
    – BigOmar
    Jul 28, 2011 at 14:19
  • What does the yellow bar under the ribbon say...something about inheritance?
    – Rob D'Oria
    Jul 28, 2011 at 14:20
  • this is the message in the yellow bar "Some content on this site has unique permissions which are not controlled from this page"
    – BigOmar
    Jul 28, 2011 at 14:35
  • It feels like a lack of permissions issue, but I would think you wouldn't even be able to see the page if you didn't have the right permissions (i.e. site collection owner/admin). What browser are you using? Do you see any indicator of an error in the status bar of the browser?
    – Rob D'Oria
    Jul 28, 2011 at 15:39

If you want the person to have unconditional read privileges you might want to consider using a Web Application Policy in Central Admin instead. This will override all security defined in a site collection for that user/permission.


  1. Define it once and that person has those permissions on all sites in that Web app, regardless of inheritance
  2. The user gets the defined permissions even on new sites that are added after you make the change (unlike the aforementioned scripted approach) and on sites that break inheritance
  3. SharePoint itself uses this method in order to configure Read permissions for the Search Crawler so it is a well-proven and supported approach.


  1. Permissions set in a Web App Policy override even the strictest item level security, meaning that users set in this fashion can see anything in that web app.
  2. These permissions do not appear at all in the UI for the site collection, which makes complete reporting of permissions tricky

If that is the route you want to take, defining a web application policy takes less than a minute and only has to be done once per farm so using a script is probably pointless.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.