SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

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 new to SharePoint and am writing PowerShell scripts to create a number of libraries. Each library will be added as a list webpart on a webpart page for added security. Finally, the page is added to navigation. I have been able to write the code for creating the libraries, pages and the navigation and added security to both the navigation and the library. So, users without access to certain pages will not be able to see the navigation and the library. However, if someone has a link to the page, they will be able to go directly to the page without using the navigation.

Can someone please point me in the right direction so I can add security to the pages as well or is it even possible?

share|improve this question
up vote 0 down vote accepted

If the page is in a list, you could probably reuse your code setting permissions on the library. Access you list like and set unique permissions, like the following:

$site = Get-SPSite("http://SiteUrl")
$web = $site.RootWeb
$list = $web.Lists["Site Pages"]
$listitem = $list.Items[0]

if($listitem.HasUniqueRoleAssignments -eq $false) 

share|improve this answer
Thanks for that. But I was wondering how to set the security if I already have the page object. If there is no way to set it with the already secured page object, then I guess I'll try your solution. – Divi Mar 13 '13 at 22:12

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.