SharePoint warmup script
# trivial sample:
# for every site I can find, try to load it.
# this reloads caches and loads any DLL's etc.
# so that everything is ready for the first user
#
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
function warmup-farm {
$SPfarm = [Microsoft.SharePoint.Administration.SPFarm]::get_Local()
$SPWebServices = new-object Microsoft.Sharepoint.Administration.SPWebServiceCollection($SPFarm)
foreach ($SPWebService in $SPWebServices) {
foreach ($SPWebApplication in $SPWebService.WebApplications) {
foreach ($SPSite in $SPWebApplication.Sites) {
foreach ($SPweb in $SPSite.AllWebs) {
if ($SPweb.IsRootWeb) {
$pageHtml = Warmup-SPsite($SPWeb.Url)
}
}
}
}
}
}
function Warmup-SPSite($url) {
$wc = new-object Net.WebClient
$wc.UseDefaultCredentials=$TRUE
return $wc.DownLoadString($url)
}
warmup-farm