Removing Super User and Super Reader account

A colleague of mine had issues with the object cache user accounts (Super User and Super Reader accounts). He used the blog post addressing the access denied errors. The post describes setting the Super User and Super Reader, but it did not describing removing both properties.

My colleague needed to remove the properties, this PowerShell script removes both properties:

# Remove properties $wa = Get-SPWebApplication -Identity "<WebApplication>" $wa.Properties.Remove("portalsuperuseraccount") $wa.Properties.Remove("portalsuperreaderaccount") $wa.Update() Write-Host("Properties count for " + $wa.Url + ": " + $wa.Properties.Count)

I hope it helps those who want to undo their settings. To complete the script:

# Get current properties $wa = Get-SPWebApplication -Identity "<WebApplication>" $user = $wa.Properties["portalsuperuseraccount"] $reader = $wa.Properties["portalsuperreaderaccount"] # Write current properties Write-Host("Properties count for " + $wa.Url + ": " + $wa.Properties.Count) Write-Host("Super user (" + $wa.Url + "): '" + $user + "'") Write-Host("Super reader (" + $wa.Url + "): '" + $reader + "'")

Advertisements