
[英]Finding Active Directory user objects in adjacent OU's to built in Users OU using PowerShell
[英]Move Active Directory Group to Another OU using Powershell
如何使用Powershell将活动目录组移动到另一个组织单位?
即。
我想移动“IT部门”小组:
(CN=IT Department, OU=Technology Department, OU=Departments,DC=Company,DC=ca)
至:
(CN=IT Department, OU=Temporarily Moved Groups, DC=Company,DC=ca)
你的脚本非常接近正确(我非常感谢你的回复)。
以下脚本是我用来解决问题的原因:
$from = [ADSI]"LDAP://CN=IT Department, OU=Technology Department, OU=Departments,DC=Company,DC=ca"
$to = [ADSI]"LDAP://OU=Temporarily Moved Groups, DC=Company,DC=ca"
$from.PSBase.MoveTo($to,"cn="+$from.name)
我还没试过这个,但是应该这样做..
$objectlocation= 'CN=IT Department, OU=Technology Department, OU=Departments,DC=Company,DC=ca'
$newlocation = 'OU=Temporarily Moved Groups, DC=Company,DC=ca'
$from = new-object System.DirectoryServices.DirectoryEntry("LDAP://$objectLocation")
$to = new-object System.DirectoryServices.DirectoryEntry("LDAP://$newlocation")
$from.MoveTo($newlocation,$from.name)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.