I have a sharepoint portal which have hundreds of subsites. The users can create new site and by default when a site is created it has Libraries, lists and discussions link out of the box. I got a request from users to remove all the Site Pages link (under libraries section).

Can this be accomplished using PowerShell script?

2 Answers 2

$site = Get-SPSite -Identity http://myportal
foreach ($web in $site.AllWebs) { 
   $list = $web.Lists["Site Pages"]
   $list.OnQuickLaunch = $FALSE 
  • Your answer even though it will work fine, is a re-active one which requires the powershell scriplet to be run everytime a site is created. See my answer below for a better solution.
    – Fox
    Mar 5, 2012 at 8:11
  • 1
    I can agree because I've answered only concerning the already created sites and the ability to use the powershell. Of course it's not help to manage the sites will be created int the future. Yes, the site template is one of the easiest option to handle it without touching Visual Studio.
    – Alex Boev
    Mar 5, 2012 at 8:51

The short and long answer is : Use a site template of course. Create a site which you customise the way you want by removing the Site Pages link and complete all your other customisations for that site.

Backup the site as a template.

Configure your root web to allow that site template for new sites.

  • Thanks Fox. The script by alex helped me to temporarily fix this issue and as you said I have to change the site template and I think I have to remove the Site pages from NavBars section in Onet.XML file. Mar 5, 2012 at 12:46
  • Hi There. Instead of hand editing the onet.xml, why dont you just edit a site created with that template and resave the template? Sometimes we overcomplicate things for ourselves. The gold rule with Sharepoint is KISS (Keep it simple stupid) <-- Not saying your'e stupid, but you catch my drift?
    – Fox
    Mar 6, 2012 at 5:55

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.