We have all seen the following error in the Application Event viewer after installing a clean SharePoint installation and creating site collections (Event ID 7362):
The first time I saw this error I figured there had to be a way to do this in PowerShell. This post helped me achieve my goal: Mirjam’s blog.
Because I implement several new farms each month, I was getting annoyed that I had to set the permissions and then use PowerShell to set the accounts for each web application.
I created the following PowerShell script to enable the caching for all Web applications. The 2 users that are explained in Mirjam’s blog have to already exist in the current environment.
If there are any questions or remarks regarding the script I would be pleased to hear them, so I can update the script and hopefully improve it. So here it is:
|# This script will add the superuser and superreader account to the Policy for web app
# and also set the web application properties so that the users will be used for caching
# The script is designed in a way that you do NOT have to adjust the script before useAdd-PSSnapin Microsoft.SharePoint.PowerShell
#foreach statement that will loop through all web applications
Write-Host "$webapp.displayname has been configured correctly"