Configure Object Caching accounts using PowerShell

If you want your Object Caching to work properly in SharePoint, you need to set 2 user accounts:

  • Portal Super Reader
  • Portal Super User

Additionally, they must be configured correctly. That is, you need to do 2 things:

  • Add a “Full Control” user policy to your web application for the Portal Super User and use PowerShell to create a web application property “portalsuperuseraccount” which has a value that’s exactly the same as the displayname of that user in the user policy.
  • Add a “Full Read” user policy to your web application for the Portal Super Reader and use PowerShell to create a web application property “portalsuperreaderaccount” which has a value that’s exactly the same as the displayname of that user in the user policy.

A lot of mistakes are made when doing this manually as a result of typo’s. Especially when you are working with claims.

To avoid this, you can use the script below to do the necessary actions. You simply provide the URL of the web application and both user accounts and the script will do the rest.

And voila, your life just got a little less complicated. 🙂