This idea comes from Kirk Hofer’s blog, but modfied to use the SharePoint 2010 powershell commandlets and not care about specifying credentials in the script. I figured most people would just keep using the credentials specified in their scheduled task.
The script loads the SharePoint plugin, enumerates the zones, and sends a request to each one.
Add-PSSnapin Microsoft.SharePoint.PowerShell;
function Get-WebPage([string]$url)
{
$wc = new-object net.webclient;
$wc.credentials = [System.Net.CredentialCache]::DefaultCredentials;
$pageContents = $wc.DownloadString($url);
$wc.Dispose();
return $pageContents;
}
Get-SPAlternateUrl -Zone Default | foreach-object {
write-host $_.IncomingUrl;
$html = Get-WebPage -url $_.IncomingUrl;
}
Pingback: SharePoint warmup script for loadblanced WFE’s | Bram's SharePoint Adventure
Pingback: Roundup: SharePoint Warm-Up Scripts
Pingback: SharePoint 2010 WarmUp « There's always a solution in the wood of features
Pingback: Run Warmup Script on Startup | SharePointed
Pingback: Sharepoint Warmup Script « Sharepoint…
Pingback: SP Warm-up « RaSor's Blog
Commenting on an older post … but thanks for this, much simpler than other stuff out there. Note you’re assuming there’s a site collection at the root of the web app. This might not always be the case. Could do something like,
$wa = Get-SPWebApplication $url
$siteurl = $wa.Sites[0].Url
$pageContents = $wc.DownloadString($siteurl)
You’re right on the assumption. I don’t know that I’ve ever seen an app configured without a root site collection, but it’s probably doable. Glad you enjoyed the script!
Pingback: Setting up an IIS Warm-up Script in an automated fashion ← Henrik Palm