2014-02-07 28 views
0

如何将组“管理员”添加到所有OU允许使用powershell全权控制的条目?Powershell:将组添加到所有OU权限

可以使用任务主动角色。

我没有在我的尝试:

$test=Get-ADOrganizationalUnit -Filter 'Name -like "*"' -searchscope onelevel | FT Name | ForEach-Object{ Add-QADPermission -"$test" -Account "administrators" -ApplyTo ChildObjects -Rights genericall} 

回答

0
Get-ADOrganizationalUnit -Filter 'Name -like "*"' -searchscope onelevel | Select -ExpandProperty DistinguishedName | ForEach-Object{ Add-QADPermission "$_" -Account 'domainName\administrator' -Rights 'GenericAll' -ApplyTo 'ChildObjects'} 

这应该让所有OU在域的根目录,然后为每个OU将管理员组添加到所有子对象和任何从他们身上降临。如果您想包含第一级OU,您可能希望将“ChildObjects”更改为“全部”。

如果您有任何问题或疑问,请发表评论。

+0

出现错误:警告:无法查找标识的对象:@ {DistinguishedName = OU = testOU,DC = test,DC = local} – shellcommander

相关问题