이 활성 디렉토리 그룹을 다른 OU Powershell
-
09-06-2019 - |
문제
이동하려면 어떻게 해야 합 active directory 그룹을 다른 조직 단위를 사용하여 Powershell?
ie.
이 그룹이"그것은 부서에서":
(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)
제휴하지 않습니다 StackOverflow