PID errors shown when script is run

Dec 10, 2013 at 6:34 PM
Edited Dec 10, 2013 at 6:34 PM
While attempting to run SPBestWarmUp for the first time on my new SharePoint 2013 farm, I am seeing the following errors. An IE window appears prompting for credentials, and the script never completes. I have to kill it with CTRL-C.

Tip: to install on Task Scheduler run the command "SPBestWarmUp.ps1 -install"
Opening Web Applications...
Navigating to http://spdemomysite.domain.com/
Navigating to http://spdemomysite.domain.com/_layouts/viewlsts.aspx
Cannot overwrite variable PID because it is read-only or constant.
At C:\Install\SPBestWarmUp.ps1:120 char:3
  • $pid = $global:ieproc.id
  • ~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : WriteError: (PID:String) [], SessionStateUnauthorizedAccessException
    • FullyQualifiedErrorId : VariableNotWritable
Navigating to http://spdemomysite.domain.com/_vti_bin/UserProfileService.asmx
Cannot overwrite variable PID because it is read-only or constant.
At C:\Install\SPBestWarmUp.ps1:120 char:3
  • $pid = $global:ieproc.id
  • ~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : WriteError: (PID:String) [], SessionStateUnauthorizedAccessException
    • FullyQualifiedErrorId : VariableNotWritable
Navigating to http://spdemomysite.domain.com/_vti_bin/sts/spsecuritytokenservice.svc
Cannot overwrite variable PID because it is read-only or constant.
At C:\Install\SPBestWarmUp.ps1:120 char:3
  • $pid = $global:ieproc.id
  • ~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : WriteError: (PID:String) [], SessionStateUnauthorizedAccessException
    • FullyQualifiedErrorId : VariableNotWritable
Navigating to http://spdemo.domain.com/
Cannot overwrite variable PID because it is read-only or constant.
At C:\Install\SPBestWarmUp.ps1:120 char:3
  • $pid = $global:ieproc.id
  • ~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : WriteError: (PID:String) [], SessionStateUnauthorizedAccessException
    • FullyQualifiedErrorId : VariableNotWritable
Navigating to http://spdemo.domain.com/_layouts/viewlsts.aspx
Cannot overwrite variable PID because it is read-only or constant.
At C:\Install\SPBestWarmUp.ps1:120 char:3
  • $pid = $global:ieproc.id
  • ~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : WriteError: (PID:String) [], SessionStateUnauthorizedAccessException
    • FullyQualifiedErrorId : VariableNotWritable
Navigating to http://spdemo.domain.com/_vti_bin/UserProfileService.asmx
Cannot overwrite variable PID because it is read-only or constant.
At C:\Install\SPBestWarmUp.ps1:120 char:3
  • $pid = $global:ieproc.id
  • ~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : WriteError: (PID:String) [], SessionStateUnauthorizedAccessException
    • FullyQualifiedErrorId : VariableNotWritable
Dec 10, 2013 at 9:18 PM
Ok I fixed this. Turns out that while accessing SharePoint sites with fully qualified host headers, IE would prompt for credentials which hung the warm up script. After adding the web application URLs to Trusted Sites in IE, and setting a Custom level to use the current credentials, the warm up script ran fine.
May 22, 2014 at 10:21 AM
There is an error in the script. Actually it's not permitted to use the name $pid for a variable. Otherwise the script will not be able to end the IE instance. You need to rename the variable to $pidSomething at this two places:
$pidProcess = $global:ieproc.id
Write-Host " IE not responding. Closing process ID $pidProcess"
This should be corrected in the script
Marked as answer by Samurai_ka on 11/5/2015 at 8:26 AM