SharePoint Warm Up PowerShell script

For those of you who have to schedule those IISRESETs on your servers to clean memory and then do not want the time it takes the end user to hit the site and warm up the ASPX pages, here is a PowerShell script that is much to the liking.  I have seen others done in VBScript, but this is way cooler:

############################################################################
#Assumptions:
#-Running on machine with WSS/MOSS
#-C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN in path
############################################################################

$output=stsadm -o enumzoneurls
$x=$output
$x.ZoneUrls.Collection|
foreach-object -process {$y=stsadm -o enumsites -url $_.Default;$sites=$y;$sites.Sites.Site}|
foreach-object -process {write-host $_.Url; $html=[System.Net.WebRequest]::Create($_.Url);}

That is it, nothing else too crazy about this one.  It loops through all the web applications and then site collections and hits them all.  If you like PowerShell, and you know you do now…this is the icing…enjoy!

from http://blogs.inetium.com/blogs/khofer/archive/2007/11/13/simple-sharepoint-warm-up-script.aspx

  • Pankaj Jain

    Warm-up script for sharepoint is fine only with web application and site collection. But throw error when site collection contain subsites.Please let me know how to make the neccessary changes so that it could also hit the sites in every site collection. I would really appriciate if you send the solution on my Email-Id.