Blog

Share this blog : twitter

Mar 16

Written by: IOTAP ::-- SharePoint Team
Tuesday, March 16, 2010 5:57 PM 

Normally all the Application Pools that get created are scheduled to reset themselves at a certain time usually around 1.45 AM in the morning. Therefore if you browse the web site for the time, it takes long time to load the web application but instead of using this script, it speed the web application.

So if you want this script, add the below code I have provided in a PS1 script and scheduled in windows scheduled task list. You can remove those app pool recycles that are scheduled

Save the following in a script named SharepointWarmUpscript.ps1 (1 is numeric value one).

Code:

iisreset

############################################################################

#Assumptions:

#-Running on machine with WSS/MOSS

#-C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN in path

############################################################################

function get-webpage([string]$url,[System.Net.NetworkCredential]$cred=$null)

{

$wc = new-object net.webclient

if($cred -eq $null)

{

$cred = [System.Net.CredentialCache]::DefaultCredentials;

}

$wc.credentials = $cred;

return $wc.DownloadString($url);

}

#This passes in the default credentials needed. If you need specific stuff you can use something else to

#elevate basically the permissions. Or run this task as a user that has a Policy above all the Web Applications

#with the correct permissions

$cred = [System.Net.CredentialCache]::DefaultCredentials;

#$cred = new-object System.Net.NetworkCredential("username","password","machinename")

[xml]$x=stsadm -o enumzoneurls

foreach ($zone in $x.ZoneUrls.Collection) {

[xml]$sites=stsadm -o enumsites -url $zone.Default;

foreach ($site in $sites.Sites.Site) {

write-host $site.Url;

$html=get-webpage -url $site.Url -cred $cred;

}

}

 

 

Then go to the windows scheduled task, add new task and scheduled when you want and run it.

You can understand the difference between default scheduled recycling and the warm up script.

clip_image002

 

 

 

Written by

A.Ramu

Tags:

1 comment(s) so far...

Re: SharePoint Warm up Scripts for WSS/MOSS using power shell

Thanks for such a beautifully composed, WSS/MOSS using power shell article.I think your work to this is really great .
I really appreciate your work to this site.So thanks for it...Because this blog is really very informative and it helps me lot.

By Bingo Game online on   Tuesday, June 22, 2010 3:48 PM

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel 


 
 
 

IOTAP is an IT Consulting and Software Services Company with global delivery centers in Mumbai and Chennai, India. We are a Microsoft Gold Certified Partner and use products and technologies like Dynamics CRM, SharePoint, Silverlight, and the .Net platform to create solutions that help our customers connect, communicate and collaborate effectively