我有大量 AD 組要從一個 OU 移動到其上層 OU。目標是洗掉“女兒”OU
示例:OU=Daughter,OU=Mother,DC=test,DC=fabrikam,DC=com
我找到了一種移動 AD 物件的方法和一種洗掉 AD OU 的方法。
我不知道如何從這個女兒 OU 中獲取所有組的串列以批量移動它們。
uj5u.com熱心網友回復:
再會
你可以使用這個:
#Add the groups in a variable
$groups = Get-AdGroup -Filter * -Seachbase "OU=Daughter,OU=Mother,DC=test,DC=fabrikam,DC=com"
#Set the target OU in a variable
$targetOU = "OU=Mother,DC=test,DC=fabrikam,DC=com"
#Foreach loop to run the move-adobject
foreach ($group in $groups) {
Move-AdObject -Identity $group.samaccountname -TargetPath $targetOU
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/534707.html
標籤:电源外壳活动目录
