Warm-up script for a SharePoint Publishing Environment

I’m doing some performance tuning for a SharePoint 2010 publishing environment at a customer and I had a need for a decent warm up script. Scavenging the net gave me lots of scripts but all of them just warmed up the homepage of a site collection or at best, the homepages of the sub webs. While this might be OK for most people, I’m not satisfied with that because the homepage might be fast after warming up, as soon as a user clicks on a link to another page, he has to wait again.
So, I needed a script which warmed up ALL of my pages. Fired up my PowerGUI and came up with the following…

This pretty much was the thing I was looking for. The customer has about 2200 pages and after this script has run, each and every one of them loads immediately.

Create a cache profile in SharePoint using PowerShell

I have been looking for a way to create a new cache profile in SharePoint using Powershell. This profile can be used in the Page Output cache.
I noticed that cache profiles are stored in a list called “Cache Profiles” and implement the “Page Output Cache” content type.

So, creating a new profile shouldn’t be that difficult.

 

To add the profile to your Page Output Cache and enable the cache, you can use the following code:

AvailablePageLayouts property value has to be one a single line

Today, I was deploying a custom web template in SharePoint 2010 in which I had specified that only 9 custom page layouts were allowed. I did this by adding a property to the Publishing feature (id 22A9EF51-737B-4ff2-9346-694633FE4416) in my custom onet.xml file called AvailablePageLayouts where you specify the location and the name of the allowed page layouts.
The format of the string with the list of layouts you specify as the value for that property has to be specific:

  • the location of the page layout has to be a relative URL
  • they have to separated by a colon (:)

After I deployed the feature I created a new site from my custom template and all of a sudden I got an error:

All Page layout urls inside the string have to be server relative

The error message furthermore mentioned more information on which page layouts were affected.

When I looked at the list of page layouts I added to this property, they all had relative urls.
Since the 1st layout was not mentioned in the error, something started to go wrong with the second one. I placed each page layout on a new line because that was so much easier than a single line and this was the problem. So, I put everything on a single line and for sure… this solved the error. My site was created successfully and only the 9 specified page layouts were available.

Update (4/12/2011): Someone commented on this post that you can actually split the page layouts over multiple lines for readability. You just need to start each new line with the colon. And he’s right. The next does work: