Building a script to restart REPORTING SERVICES automatically

Sometimes it can be useful to restart Reporting Services automatically using a script to avoid the initialization time it takes to start Reporting Services the first time it is being accessed, or to control the recycle process of the web service.


The following article explains how Reporting Services performs the recycle operations (planned or unplanned):

Application Domains for Report Server Applications  


Additionally it could be possible that the recycle process happened when the memory pressure is high. More information in the following article:

Configuring Available Memory for Report Server Applications




Reporting Services performs a recycle of the Report Server service every 12 hours (by default) depending on the value RecycleTime in the configuration file.
It is not possible to know the time in which the next recycle is going to happen.

An alternative could be implementing a script that restarts Reporting Services (for example every night at the same time) and, once restarted, accesses the Report Server to refresh the cache.



A good approach would be to control the recycling process and avoid it from happening during the execution of your reports/subscriptions/scripts would be to create a script
in PowerShell that:


  1. Restarts the Reporting Services Service
  2. Then wakes up the Report Manager to avoid the extra time it takes to load the page the first time is used.


The script could look like this (in PowerShell):

Stop-Service "SQL Server Reporting

Start-Service "SQL Server Reporting

$wc = New-Object

$cred = [System.Net.CredentialCache]::DefaultNetworkCredentials

$wc.Credentials = $cred

$src = $wc.DownloadString("http://localhost/Reports/Pages/Folder.aspx")


Note: You need to substitute localhost by the name of your server

You will run this script at the same time every day.


To automate the PS script to run periodically we can use the follow command: schtasks

You can find more Information at:

Or simply create a job in SQL Server to run the script.



In the following link you can see the necessary permissions by the account that runs the rs script: (



I hope it helps,


Maria Esteban

Reporting Services Support Engineer


Comments (3)
  1. kiquenet says:

    Thanks. It's good !!

    any full source code sample powershell script ?

    Any ps1 script for modify configs for performs the recycle operations (value RecycleTime)  and/or configure available memory ?

    Any full sample ps1 script for schtasks?

    Any full sample ps1 script for create a job in SQL Server ?


  2. CJ says:

    I wanna stop automatically when windows starts SQL reporting service so that wampserver can use the port 80 …

  3. Earl Grey says:

    Good God, are you seriously saying that MS just stops/starts stuff randomly, sometime around every 12 hours and there's no configuration option for it?? Can't wait for Google to put out a business OS.

Comments are closed.

Skip to main content