title: SQL Server Powershell Error
body: <p>Morning,</p>
  
  <p>I have a small error with a Powershell Script I'm running on one of my servers.</p>
  
  <p>Due to the nature in which SQL Server Reporting Services works on the later SSRS I have a powershell script that recycles the app pool and then uses DownloadString to get the URL to a string and force the pre-cache of the page.</p>
  
  <p>Originally I had this script running locally on the SQL Server itself but I have moved it off that server, I am now receiving the following error:</p>
  
  <blockquote>
    <p>Exception calling "DownloadString" with "1" argument(s): "The remote server returned an error: (500) Internal Server Error.". The remote server returned an error: (500) Internal Server Error.</p>
  </blockquote>
  
  <p>The script looks like this </p>
  
  <pre><code>Stop-Service "SQL Server Reporting Services (MSSQLSERVER)"
  Start-Service "SQL Server Reporting Services (MSSQLSERVER)"
  $wc = New-Object system.net.webClient
  $cred = [System.Net.CredentialCache]::DefaultNetworkCredentials
  $wc.Credentials = $cred
  $wc.DownloadString("http://server/Reports/Pages/Folder.aspx")
  </code></pre>
  
  <p>Anybody able to point me in the right direction.</p>
  
  <p>Cheers.</p>