OneScript Team Blog

A world of automation script samples based on IT Pros' real-world tasks

[Script of Mar. 18] PowerShell Scripts to Warm-Up Applications in Microsoft SharePoint Server 2010

[Script of Mar. 18] PowerShell Scripts to Warm-Up Applications in Microsoft SharePoint Server 2010

  • Comments 1
  • Likes

Script Download: WarmupSiteApplication.zip
http://gallery.technet.microsoft.com/scriptcenter/PowerShell-to-Warm-Up-0988dd61

This script could be used to warm-up site application.

Application warm-up is requested to improve customer experience for the sites taking long time on initialization after application pool recycling.

image image
image

You can find more All-In-One Script Framework script samples at http://aka.ms/onescriptingallery

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Here is the script that I use.  The benefit is that is uses the SharePoint snapin to determine what sites are available in the farm and hits each one to warm it up.  New sites will automatically be warmed up.  I schedule it on one of the web front end servers in the farm.

    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction:SilentlyContinue

    function Get-WebPage

    {

    param(

    [string]$url

    )

    Write-Host "Getting $url"

    $wc = New-Object Net.Webclient

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

    return $wc.DownloadString($url);

    }

    Get-SPWebApplication -IncludeCentralAdministration | %{ Get-SPSite $_.Url } | Get-SPWeb | %{

       $null = Get-WebPage -url $_.Url

    $_.Lists | ?{ -not $_.Hidden } | %{

           Get-WebPage "$($_.ParentWeb.Site.Url)$($_.DefaultViewUrl)" | Out-Null

    }

    }