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.