Passaggio all'ora legale 31 marzo 2024 02:00 03:00 sposta avanti l'orologio di 1 ora (si dorme 1 ora in meno)
Uno script in PowerShell 2 per SharePoint Server 2010 per settare gli utenti Cache Super User e Cache Super Read su una o più Web Application.
PowerShell: AddCacheUsers.ps1
# file: AddCacheUsers.ps1
# https://www.sgart.it/IT/informatica/impostare-gli-utenti-cache-super-users-e-cache-super-reader/post
# aggiunge gli utenti della Cache alle policy di tutte le zone
# Cache Super User con policy for WebApp Full Control
# Cache Super Read con policy for WebApp Full Reader

#impostare le url delle web application da impostare
$urls = @(
   "http://sito1.sgart.it"
 , "http://sito2.sgar.it"
)

#impostare gli utenti della cache
#occhio all'escape della pipe
$su = "i:0#.w`|sgart\SPCache_SU"   #Cache Super User - claims
$sr = "i:0#.w`|sgart\SPCache_SR"   #Cache Super Read - claims

#--------------------------------------------
$suRoleName = "Full Control"
$srRoleName = "Full Read"

$urls | foreach{
  write-host "Url: $_" -f green
  $wa = Get-SPWebApplication $_

  write-host " Cache Super User: $su" -f green
  $suRole = $wa.PolicyRoles | where {$_.Name -like $suRoleName}
  $suPolicy = $wa.Policies.Add($su, "Object Cache Super User")
  $suPolicy.PolicyRoleBindings.Add($suRole)
  $wa.Properties["portalsuperuseraccount"] = $su

  write-host " Cache Super Reader: $sr" -f green
  $srRole = $wa.PolicyRoles | where {$_.Name -like $srRoleName}
  $srPolicy = $wa.Policies.Add($sr, "Object Cache Super Reader")
  $srPolicy.PolicyRoleBindings.Add($srRole)
  $wa.Properties["portalsuperreaderaccount"] = $sr

  write-host "Updating $_ ..."
  $wa.Update()
}
in questo esempio uso delle credenziali Claims.
In pratica imposta delle proprietà (portalsuperuseraccount e portalsuperreaderaccount) e setta le policy utente della WebApplication.

Possibili errori correlati ad una errata impostazione degli utenti Cache Super User e Cache Super Reader:
Impossibile accedere alla site collection anche da parte del Site Administrator o dal Farm Admin
Object Cache: The super reader account utilized by the cache does not have sufficient permissions to SharePoint databases.
To configure the account use the following command 'stsadm -o setproperty -propertyname portalsuperreaderaccount -propertyvalue account -url webappurl'. It should be configured to be an account that has Read access to the SharePoint databases.
Additional Data:
Current default super reader account: NT AUTHORITY\LOCAL SERVICE
DelegateControl: Exception thrown while adding control 'ASP._controltemplates_metadatanavtree_ascx': Thread was being aborted.

Se capita l'errore
Unexpected User key value from token is not a user key so throwing. UserKey: 'i:0#.w|dominio\spcachesuperuser'
Assicurarsi che l'utente sia abilitato in Active Directory.
Potrebbe interessarti anche: