MinimaList SharePoint WarmUp Script

In the spirit of Minimalism I have decided to create the simplest SharePoint warm up script that I could.  There are plenty of warm up scripts on the web.  Many of them are convoluted and difficult to manage.  This shouldn't be that difficult.  All you need to do is enumerate your web applications and site collections.  Then make a simple web call to each of them using the correct credentials.  Once you have that all you need is a scheduled task to hit them on regular intervals. 

So here it is:

$wc = New-Object net.WebClient

$wc.Credentials = [System.Net.CredentialCache]::DefaultCredentials

Get-SPSite | ForEach {$wc.DownloadString($_.url)}

 

Bing! Simple right?

This will not hit the Central Administration site.  To do this  just add the following 2 lines.

$caUrl = "*https://servername:5555"

$wc.DownloadString($caUrl)

 *Specify your specific central admin url.

______________________________________________________________________________________________________________

1. Create a PS1 file called warmup.ps1 and put these line in it:

$wc = New-Object net.WebClient

$wc.Credentials = [System.Net.CredentialCache]::DefaultCredentials

Get-SPSite | ForEach {$wc.DownloadString($_.url)}

$caUrl = "https://servername:5555"

$wc.DownloadString($caUrl)

 

2. Create a batch file with this line in it:

 powershell -command "& 'c:\warmup.ps1'"

 

3. Next you will need to setup a scheduled task.  Open Task Scheduler > Create New Task… >

 If you run this as hidden you will not see a popup.  Ensure that the task runs whether the user is logged on or not.

Set to run Daily and repeat every 10 minutes or so.  I like to ensure that the sites are fresh more often.

Select the warm up batch file that you just created.

Finally set the account that will run the scheduled task.  I would use the SharePoint System Account

______________________________________________________________________________________________________________

TESTING

On your SharePoint server temporarily change your Internet Explorer home pages to hit all of your site collections or at least web applications including Central Admin.

Test from a command line:

iisreset

powershell -command "& 'c:\warmup.ps1'"

"C:\Program Files\Internet Explorer\iexplore.exe"

 You should see your sites load very quickly.  As always please test before you try this on your production farm.