Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I know how to delete permissions from lists and document libraries. Simply I can use the BreakRoleInheritance, and I can remove every user. But I couldn't find a way to do this with a site.

Like this: $site =new-object Microsoft.SharePoint.SPSite (http://spt/spaces/thisisit)

$site doesn't have inheritance method (or I just don't know how to use it).

So how can I delete every permission on a site? Not on the lists, not on the document libraries, but on the site itself?

share|improve this question
    
I really recommend you to read up on the differences between site collections, and sites in SharePoint (hence SPSite and SPWeb objects) as well as the basic security features of SP. sharepoint.stackexchange.com/questions/23241/… for SPWeb vs SPSite, technet.microsoft.com/en-us/library/cc262939(v=office.14).aspx for permissions and security –  Robert Lindgren Aug 27 '13 at 13:17
add comment

1 Answer

up vote 0 down vote accepted

You need to get the web object of the site to break the inheritance:

$web = Get-SPWeb -Identity $Url
$web.BreakRoleInheritance($True)

UPDATE

If you want to delete permission levels in root web, you can do it this way:

$web = Get-SPWeb -Identity http://sp2010:90
$PermissionLevel=$web.RoleDefinitions
$PermissionLevel.Delete("Contribute")
share|improve this answer
    
This seems to be the way. But i got an error: "Cannot change permissions of root web: I am the owner with full control. Why can't i modify it? –  Lokids Aug 27 '13 at 12:50
    
The error is obvious, you break inheritance for child webs not root web. Rootweb doesn't inherit from anything. –  Nadeem Yousuf Aug 27 '13 at 12:57
    
Hmmm. I thought the stp is the root web. But the "thisisit" is also root? Because then i have an another problem. How can i delete every user on root web? –  Lokids Aug 27 '13 at 13:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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