Déplacer un groupe Active Directory vers une autre unité d'organisation à l'aide de Powershell

StackOverflow https://stackoverflow.com/questions/76325

  •  09-06-2019
  •  | 
  •  

Question

Comment déplacer un groupe Active Directory vers une autre unité organisationnelle à l'aide de Powershell?

c'est-à-dire

Je souhaite déplacer le groupe "Département informatique". à partir de:

  (CN=IT Department, OU=Technology Department, OU=Departments,DC=Company,DC=ca)

à:

  (CN=IT Department, OU=Temporarily Moved Groups, DC=Company,DC=ca)
Était-ce utile?

La solution

Votre script était sur le point d'être corrigé (et j'apprécie vraiment votre réponse).

Le script suivant est ce que j'ai utilisé pour résoudre mon problème:

$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)

Autres conseils

Je n'ai pas encore essayé, mais cela devrait le faire ..

$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)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top