To convert a WebApplication from classis to claims, you can use the script below. Make sure the required parameters $WebAppName, $account and $wa are correct for your enviroment.
-----------------------------------------
Add-PSSnapin Microsoft.SharePoint.PowerShell
$WebAppName = "http://[URL WEBAPPLICATION]"
$account = "[DOMAIN]\[FARM ADMIN ACCOUNT]"
$wa = get-SPWebApplication $WebAppName
# This will set the webapp to claims
Set-SPwebApplication $wa -AuthenticationProvider (New-SPAuthenticationProvider) -Zone Default
#This step will create the admin for the site
$account = (New-SPClaimsPrincipal -identity $account -identitytype 1).ToEncodedString()
# Once the user is added as admin, we need to set the policy so it can have the right access
$zp = $wa.ZonePolicies("Default")
$p = $zp.Add($account,"PSPolicy")
$fc=$wa.PolicyRoles.GetSpecialRole("FullControl")
$p.PolicyRoleBindings.Add($fc)
$wa.Update()
# Final step is to trigger the user migration process from classic to claims
$wa.MigrateUsers($true)
Geen opmerkingen:
Een reactie posten