How to warm-up SharePoint or other web applications and WCF (SOAP) services with PowerShell
There are many reasons you might want to warm-up a web application occasionally. It can be after a fresh deployment or on a regular basis after recycling application pools. Some times you might also need to warm-up SOAP services without going through front-end.
It might seems to be any easy task specially if you have PowerShell 3.0 or higher on your servers, but after Googling a while and reviewing some of the top hits I discovered that each solution is missing a part. Some only work in a single server scenario and some has forgotten that each HTTP response might contain links to scripts and images that we need to download and finally I could not find anything for SOAP services that just works. Long story short I decided to put together a simple script that just works and is easy to change to everyone's needs.
Please note that my only assumption is you have PowerShell 3.0+ in your servers.
Currently the script takes care of the following tasks, but I will most likely improve it to cover other useful scenarios.
- Calling SOAP operations and sending parameters and custom headers
- Calling front-end URIs and downloading scripts and images that are local to the front-end
- Logging to a configurable folder and file name
- Cleaning up old log files
Currently, I have the following points in mind to improve the script.
- Put configuration in a different file.
- Improve function definitions (named and typed parameters and description).
- Default values for parameters when it makes sense (e.g. log folder can be the current folder).
- Support REST services.
https://gist.github.com/rezanid/7cdfe07040591cf9667e4118e6c3ac7a
I'm open to any suggestion and feature request. Please let me know if you found it useful or if have got something wrong.