powerShell赋权限

1.给网站赋权限 

Set-SPUser –Identity “用户名” –AddPermissionLevel “参与讨论” –web “http://url”

2.给列表赋权限

$web = Get-SPWeb http://url

$account = $web.EnsureUser("用户名")

$role = $web.RoleDefinitions["参与讨论"]

$list = $web.Lists["thxtest"]

$list.BreakRoleInheritance($true)

$assignment = New-Object Microsoft.SharePoint.SPRoleAssignment($account)

$assignment.RoleDefinitionBindings.Add($role)

$list.RoleAssignments.Add($assignment)

$list.Update() $web.Dispose()

posted on 2013-09-09 10:04  瓶装的生活  阅读(423)  评论(0编辑  收藏  举报