powershell 这将遍历站点中的所有子站点,并且添加组可设置组的权限。打破或重置的好例子

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 这将遍历站点中的所有子站点,并且添加组可设置组的权限。打破或重置的好例子相关的知识,希望对你有一定的参考价值。

Add-PsSnapin Microsoft.SharePoint.PowerShell

function setPermissions($NewGroup,$PermissionLevel,$web)
{
    #Assign Permissions to the Group
    $group = $web.SiteGroups[$NewGroup]
    $GroupAssignment = new-object Microsoft.SharePoint.SPRoleAssignment($group)

    #Get Full Control Role (Permission Level)
    $GroupRoleDefinition = $web.Site.RootWeb.RoleDefinitions[$PermissionLevel]
     
        #Bind Full Control
    $GroupAssignment.RoleDefinitionBindings.Add($GroupRoleDefinition)
 
    #Grant Full control to the Web
    $web.RoleAssignments.Add($GroupAssignment)

}

$topSite = Get-SPWeb http://scushp01/Branches
foreach($s in $topSite.Webs)
{
    ##$s.Update()
    ##$s.ResetRoleInheritance()
    
    ##$s.BreakRoleInheritance($False)
    ##$s.Update()
	$s.Title
	
    $NewMembers = $s.Title + " Members"
    $NewVisitors = $s.Title + " Visitors"
    $NewEditors = $s.Title + " Editors"
    $NewDesigners = $s.Title + " Designers"
    $NewOwners = "TheSound Owners"
    
    setPermissions $NewMembers "Contribute" $s
    setPermissions $NewVisitors "Read" $s 
    setPermissions $NewEditors "Edit" $s 
    setPermissions $NewDesigners "Design" $s
    setPermissions $NewOwners "Full Control" $s

}

以上是关于powershell 这将遍历站点中的所有子站点,并且添加组可设置组的权限。打破或重置的好例子的主要内容,如果未能解决你的问题,请参考以下文章

powershell 这将使用power shell获取特定SharePoint网站集下的所有子网站的列表。第二个文件获取我们的子站点

powershell 迭代站点中SharePoint子站点中的所有文档。它同时执行站点和所有子站点

powershell 这将使用模板在SharePoint中创建子站点。请注意,在创建网站后应用模板

powershell 这将获取用户所属的SharePoint组,以用于给定站点。这使用用户的登录名进行比较。

powershell 使用powershell创建一个健全的Intranet子站点

powershell 这将遍历SharePoint中的所有Web应用程序,然后遍历每个应用程序中的所有网站以及iter