Configure Object Cache User Accounts (All in Powershell)

In my last post I explained all the steps to configure the object cache user accounts. It´s so simple and easy… but at the same time boring and long for such a little configuration. So… powershell to the rescue.

Here is the script to run all in one step. We need the URL of the web application, and the object cache user account to use. I thought about writing the script including all web applications but I prefer to do it one by one (just in case…)


$wa = Get-SPWebApplication -Identity http://intranet.demos.local

$superUser = “i:0#.w|demosMSSCacheSUser”

$superReader = “i:0#.w|demosMSSCacheSReader”


$fullPolicy = $wa.Policies.Add($superUser, $superUser)


$readPolicy = $wa.Policies.Add($superReader, $superReader)


$wa.Properties[“portalsuperuseraccount”] = $superUser;

$wa.Properties[“portalsuperreaderaccount”] = $superReader;


Note: The script is assuming we are using Claims Mode authentication for the web app. If this is not your case, change the format of the user account for “domainuser”.

Hope it helps!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s