7 Şubat 2013 Perşembe

Setting Object Cache Accounts in SharePoint 2010

Hi,

Just copy the code below, change the first 3 parameters, you are good to go !

Note:
If you use claims auth. you need to add "i:0#.w|" in front of your username like I did.

$wa = Get-SPWebApplication -Identity http://yoururl
$SuperUserAcc = "i:0#.w|WW300\w99s0700"
$SuperReaderAcc = "i:0#.w|WW930\w99s0700"
Function Set-WebAppUserPolicy($wa, $userName, $displayName, $perm)
{
    [Microsoft.SharePoint.Administration.SPPolicyCollection]$policies = $wa.Policies
    [Microsoft.SharePoint.Administration.SPPolicy]$policy = $policies.Add($userName, $displayName)
    [Microsoft.SharePoint.Administration.SPPolicyRole]$policyRole = $wa.PolicyRoles | where {$_.Name -eq $perm}
    If ($policyRole -ne $null) {
        $policy.PolicyRoleBindings.Add($policyRole)
    }
    $wa.Update()
}

$wa.Properties["portalsuperuseraccount"] = $SuperUserAcc
Set-WebAppUserPolicy $wa $SuperUserAcc "Super User (Object Cache)" "Full Control"
$wa.Properties["portalsuperreaderaccount"] = $SuperReaderAcc
Set-WebAppUserPolicy $wa $SuperReaderAcc "Super Reader (Object Cache)" "Full Read"
$wa.Update()

Hiç yorum yok:

Yorum Gönder