Skip to main content

SharePoint Sites and Pages Powershell Warmup Script

Very nice little script i created to warmup all PWA pages and workspaces.
Simply replace the SiteURL and the SitePages with your own values and place the code in a file named "SharePointWarmup.ps1".
Run the script in Powershell or Task Scheduler.

 $SiteURL = "http://intra/PWA/"  
 $SitePages =   
 "default.aspx",  
 "projects.aspx",  
 "ProjectBICenter/_layouts/15/xlviewer.aspx?id=/PWA/ProjectBICenter/Sample%20Reports/Projectum/DailyCommentsReport%20v7%20-%20PowerView.xlsx&Source=http%3A%2F%2Fintra%2FPWA%2FProjectBICenter%2FSample%2520Reports%2FForms%2FAllItems%2Easpx%3FRootFolder%3D%252FPWA%252FProjectBICenter%252FSample%2520Reports%252FProjectum%26FolderCTID%3D0x012000271EBEF22B819D4AA417BE3C68ADBA34%26View%3D%257B857402E5%252DF616%252D4DC2%252DA880%252D5CFC03D52EFA%257D",   
 "Project%20Detail%20Pages/Project%20Information.aspx",  
 "project%20detail%20pages/schedule.aspx",  
 "project%20detail%20pages/sdc%20-%20budget.aspx"  
 Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue   
 $timeout = 240000 #=4 min   
 Add-Type -ReferencedAssemblies "System.Net" -TypeDefinition @"   
 using System.Net;   
 public class WarmupWebClient:WebClient  
 {  
   private int timeout = 60000;   
   public WarmupWebClient(int timeout) {this.timeout = timeout;}  
   protected override WebRequest GetWebRequest(System.Uri webUrl)   
   {  
     WebRequest requestResponse = base.GetWebRequest(webUrl);   
     requestResponse.Timeout = this.timeout;   
     return requestResponse;   
   }   
 }   
"@  
 function HitPage($url)  
 {  
   try   
   {   
     Write-Host "Hitting page: $url"   
     $wc = New-Object WarmupWebClient($timeout)   
     $wc.Credentials = [System.Net.CredentialCache]::DefaultCredentials   
     $ret = $wc.DownloadString($url)   
   }  
   catch [Exception]   
   {   
     Write-Host "Failed to hit page. Message was: $($_.Exception.Message)"   
   }   
 }  
 foreach ($site in $SitePages)   
 {   
   $warmupSite = $SiteURL + $site  
   HitPage($warmupSite)  
 }  
 Write-Host "All sites have been hit"   

Of cause you want this script to be run on a timely schedule so remember to check out my other post on how to do exactly that Run Powershell from Task Scheduler .

Comments

  1. Hello, it's with great happiness that I tried your script!
    thanks for that great post.
    for those who will copy the script, be careful that powershell does not support space before the "@

    Regards
    Jérome

    ReplyDelete
  2. Another comment: what is your propose schedule to run such script? daily, hourly,each minute?
    regards
    Jérome

    ReplyDelete
  3. Hi Jérome,
    Thank you for the correction with the @" (must be the HTML formatter that have added it).

    In a normal environment the IIS is configured to recycle at 02:00. So i would suggest to run the schedule on a daily basis between 03:00-08:00.
    However normally I just configure it to run every 3 hours to give a better user experience.

    Check IIS Recycle Schedule
    (from: http://technet.microsoft.com/en-us/library/cc754494(v=ws.10).aspx)
    1. Open IIS Manager.
    2. In the Connections pane, expand the server node and click Application Pools.
    3. On the Application Pools page, select an application pool
    4. Click Recycling in the Actions pane.
    5. Select Specific time(s), and in the corresponding box type a time at which you want the application pool to recycle daily.

    ReplyDelete
  4. thanks a lot for your quick answer! I really like it especially to keep excel services up and running!

    ReplyDelete

Post a Comment

Popular posts from this blog

Sharepoint 2013 - Fullscreen mode/hide quick launch

If you want to hide the quick launch on a SharePoint page or web part page in 2013 you could of cause use CSS scripts as in 2010.
But as a new thing in 2013 the user have the possibility to click on full screen mode. so why not load your page in this mode and then the user can choose to exit the mode if he prefers.

Add a content editor webpart to your page and click on Edit HTML from the ribbon.
Add the following code:

<script type="text/javascript">
window.onload = function()
{
  SetFullScreenMode(true);
}
</script>

Reporting on Microsoft Planner or Microsoft Staffhub!

Reporting on Planner or StaffHub!


For a long time I have been waiting for the reporting API for Planner and Staffhub. Today I got tired of waiting and found another way to do it.

I manage to create a PowerBI report based on all the planner plans I have access to and the same method will work for Staffhub and properly many other services such as Microsoft Tasks, Microsoft Forms, etc. 


How?Easy, but requires some Azure, Flow and PowerBI knowledge. These are the steps to I used: 1.Create an Azure Blob to hold the data 2.Create a Flow to save Planner data in the Blob 3.Access the Blob from PowerBI Azure – Blob!So first, lets create a Blob. No, not that kind of Blob. Access the Azure portal - https://portal.azure.com/ Select New and search for “storage account” Fill out the form and click create. I kept all settings to their default Access the new storage and locate/copy the Storage Account Name and Access Key – you will need this for connections to Flow and PowerBI. Next let’s create a Blob Container an…

SharePoint/Project Server - Firewall port open list

Firewall port open list Every time I have to install a new instance of Project Server I forget which ports have to be open.
The ports are divided into 3 lists, one list for the web front end servers, one list for the application server and one list for the SQL server.
These ports are based on a 2013 installation of SharePoint/Project Server. the 2010 installation defer a little bit.


Web Frontend ServerWhen a range is specified all ports between the range must be opened.
     Port(s)ProtocolBoundDescription
-80 TCPInhttp
-443 TCPInhttps/ssl
-25 TCPInSMTP for e-mail integration
-16500-16519TCPInPorts used by the search index component
-22233-22236TCPIn/OutPorts required for the AppFabric Caching Service
-32843-32845TCPInCommunication between Web servers and service applications
-32846TCPIn/OutSharePoint User Code Service
-808-809TCPInOffice Web Apps
-5725TCP