SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking to set a site admins as the only people who can use a certain page via powershell, so far I have only been able to check permissions not set any

share|improve this question
up vote 1 down vote accepted

EDIT: Misread the question you can try this

$site = get-spsite("http://MySPSite")
$web = $site.RootWeb
$list = $web.Lists["MyList"]
$listitem = $list.Items[0] 
$user = $web.AllUsers["Domain\User"]
$role = $web.RoleDefinitions["Full Control"]
$roleassignment = New-Object Microsoft.SharePoint.SPRoleAssignment($user)

I'm not sure if this will break inheritance automatically, you may have to explicitly do that for this to work.

Use set-spuser for site permissions

        Set-SPUser [-Identity] <SPUserPipeBind> [-AddPermissionLevel <String[]>] [-AssignmentCollection 
        <SPAssignmentCollection>] [-ClearPermissions <SwitchParameter>] [-Confirm [<SwitchParameter>]] 
        [-DisplayName <String>] [-Email <String>] [-Group <SPGroupPipeBind>] [-IsSiteCollectionAdmin 
        <SwitchParameter>] [-PassThru <SwitchParameter>] [-RemovePermissionLevel <String[]>] [-SyncFromAD 
        <SwitchParameter>] [-Web <SPWebPipeBind>] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]

        The Set-SPUser cmdlet configures properties of an existing user.

An Example:

Set-SPUser -Identity 'domain\name' -Web http://sp2test/site -AddPermissionLevel Read
share|improve this answer
Thanks for the fast response. So instead of -Identity "Domain\login" could I use. -Group $Site.AdministratorsGroup – user13186 Mar 19 '13 at 2:50
Groups take a bit more work. Take a look here and see if this doesn't work better for you… – Jesus Shelby Mar 19 '13 at 2:55
$listItem.RoleAssignments.Add did not work for me, I had to change it to $listItem.Web.RoleAssignments.Add – tsap Nov 11 '15 at 17:57

Your Answer


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.