使用Powershell更改所有者组的权限 [英] Change permissions for owners groups using Powershell
问题描述
Hello Techies,
我有一个场景,我们有大量的子网站,每个子网站都有自己的所有者组。由于某些管理政策,我们希望限制所有者群组的用户创建子网站。
为此我们创建了自定义权限,称为 完全控制而不创建子网站。
使用脚本,我可以从子网站获取所有者组,但也有一些其他组可以完全控制。
请帮助我如何从完全控制的子网站获取所有组并更改其权限。
这是我的脚本:
添加 - PSSnapin"Microsoft.SharePoint.PowerShell"
$ web = get-spweb http:// SubsiteURL /
$ groupTitle = $ web.Title +"业主"
$ group = $ web.SiteGroups [$ groupTitle]
$ ra = $ group.ParentWeb.RoleAssignments.GetAssignmentByPrincipal($ group)
$ rd = $ group.ParentWeb.RoleDefinitions ["完全控制"]
$ ra.RoleDefinitionBindings.Remove($ rd)
$ ra.Update()
$ group.Update()
$ role = $ web.RoleDefinitions ["完全控制没有子网站创建"]
$ RoleAssignment = New-Object Microsoft.SharePoint.SPRoleAssignment($ group)
$ RoleAssignment.RoleDefinitionBindings.Add ($ role)
#以下内容可以是网页,列表或项目对象
$ web.RoleAssignments.Add($ RoleAssignment)
$ web.Update()
$ web.Dispose()
< blockquote>
试试这个
Add-PSSnapin" Microsoft.SharePoint.PowerShell"
#
path = get-location
sites = get-spsite" http:// SP2013 / site / sam /" ;
foreach(
Hello Techies,
I have a scenario where we have a large number of subsites and each subsite has their own owner groups. Due to some governance policies we would like to restrict users from owners group from creating subsites.
For this we have created custom permissions called as Full control without Subsite creation.
And with script, i am able to get the owners group from subsites but there are some other groups as well which has full control.
Please help me how to get all groups from subsites with full control and change their permissions.Here is my script:
Add-PSSnapin "Microsoft.SharePoint.PowerShell" $web = get-spweb http://SubsiteURL/ $groupTitle=$web.Title+" Owners" $group = $web.SiteGroups[$groupTitle] $ra = $group.ParentWeb.RoleAssignments.GetAssignmentByPrincipal($group) $rd = $group.ParentWeb.RoleDefinitions["Full Control"] $ra.RoleDefinitionBindings.Remove($rd) $ra.Update() $group.Update() $role = $web.RoleDefinitions["Full control without Subsite creation"] $RoleAssignment = New-Object Microsoft.SharePoint.SPRoleAssignment($group) $RoleAssignment.RoleDefinitionBindings.Add($role) # the following could be for a web, list or item object $web.RoleAssignments.Add($RoleAssignment) $web.Update() $web.Dispose()解决方案Try this
Add-PSSnapin "Microsoft.SharePoint.PowerShell" #
path = get-location
sites = get-spsite "http://SP2013/site/sam/" foreach (
这篇关于使用Powershell更改所有者组的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!