Adds a claims user to a Service Application with Full Control
function Add-User-To-Service-Application-Administrators([string] $account, [string] $serviceApplication)
{
$principal = New-SPClaimsPrincipal $account -IdentityType WindowsSamAccountName
$spapp = Get-SPServiceApplication -Name $serviceApplication
$security = Get-SPServiceApplicationSecurity $spapp -Admin
Grant-SPObjectSecurity $security $principal "Full Control"
Set-SPServiceApplicationSecurity $spapp $security -Admin
#(Get-SPServiceApplicationSecurity $spapp -Admin).AccessRules
}
Add-User-To-Service-Application-Administrators "DEV\SPAppPool" "User Profile Service Application"
No comments:
Post a Comment