[英]How can I move a bulk of AD groups from an OU to its upper level OU?
I have a ton of AD Groups to move from an OU to its upper level OU.我有大量 AD 组要从一个 OU 移动到其上层 OU。 The goal is to remove the "daughter" OU目标是删除“女儿”OU
Exemple: OU=Daughter,OU=Mother,DC=test,DC=fabrikam,DC=com示例:OU=Daughter,OU=Mother,DC=test,DC=fabrikam,DC=com
I found a way to move AD Objects and a way to remove AD OU.我找到了一种移动 AD 对象的方法和一种删除 AD OU 的方法。
I Have no clue how to get a list of all the groups from this daughter OU to move them in a bulk way.我不知道如何从这个女儿 OU 中获取所有组的列表以批量移动它们。
Good day再会
You can use this:你可以使用这个:
#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
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.