PowerShell创建SharePoint 权限等级

参考:https://social.technet.microsoft.com/wiki/contents/articles/18661.sharepoint-2010-update-a-permission-level-using-powershell.aspx

$sites = get-spsite -Limit ALL –webapplication http://mywebapplication.com            
ForEach ($site in $Sites)            
{             
    # The URL to the Site Collection            
    $spWeb = $site.RootWeb            
             
    # Enter the Name of the Permission Level to Change            
    $PermissionLevel=$spWeb.RoleDefinitions["CustomOwner"]            
             
    # Enter all the permissions that Permission Level should have enabled            
    $PermissionLevel.BasePermissions="ViewListItems, AddListItems, EditListItems, DeleteListItems, ApproveItems, OpenItems, ViewVersions, DeleteVersions, CancelCheckout, ManagePersonalViews, ManageLists, ViewFormPages, Open, ViewPages, AddAndCustomizePages, ViewUsageData, CreateSSCSite, ManagePermissions, BrowseDirectories, BrowseUserInfo, AddDelPrivateWebParts, UpdatePersonalWebParts, UseClientIntegration, UseRemoteAPIs, ManageAlerts, CreateAlerts, EditMyUserInfo, CreateGroups, EnumeratePermissions"            
             
    $PermissionLevel.Update()            
    $spweb.Dispose()            
    $spsite.Dispose()            
}

猜你喜欢

转载自www.cnblogs.com/jpinsz/p/12587801.html