Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 34890

Warm up script in PowerShell for SharePoint 2010 Environment

$
0
0
 
 
# 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 them
foreach ($site in Get-SPSite)
{
write-host $site.Url;
$html=get-webpage -url $site.Url -cred $cred;
}


Viewing all articles
Browse latest Browse all 34890

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>