2014-02-07 30 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

相關問題