Setting super user / super reader account

This is the resolution to some tedious event log errors, which should be resolved.

add-pssnapin microsoft.sharepoint.powershell -erroraction silentlycontinue
 
function SetSuperCacheUsers()
{
[CmdletBinding()]
param (
    [string] $webApp,
    [string] $prefix,
    [string] $superuser,
    [string] $superreader
)
 
    $wa = Get-SPWebapplication -identity $webApp
 
    $wa.Properties["portalsuperuseraccount"] = ($prefix + $superuser)
    $wa.Properties["portalsuperreaderaccount"] = ($prefix + $superreader)
 
    $wa.Update()
}
 
SetSuperCacheUsers  -webApp "http://demo.escape.com" `
                    -prefix "i:0#.w`|" `
                    -superuser "escape\SPObjCacheSuper" `
                    -superreader "escape\SPObjCacheRead"
 
write-host "Now you should ensure that the accounts you set here have appropriate access in web App User Policy"
write-host "in central admin, Full control for the Super user and Full Read for the super reader"