# Warm up script for web apps along with the site collections within them in SharePoint 2010 environment
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
# The get-webpage function is from http://kirkhofer.wordpress.com/2008/10/18/sharepoint-warm-up-script/
function Get-WebPage([string]$url)
{
$wc = new-object net.webclient;
$wc.credentials = [System.Net.CredentialCache]::DefaultCredentials;
$pageContents = $wc.DownloadString($url);
$wc.Dispose();
return$pageContents;
}# Enumerate the web app along with the site collections within it, and send a request to each one of themforeach ($site in Get-SPSite)
{
write-host $site.Url;
$html=get-webpage -url $site.Url -cred $cred;
}
↧
Warm up script in PowerShell for SharePoint 2010 Environment
↧