Sposta il gruppo Active Directory in un'altra unità organizzativa utilizzando Powershell

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

  •  09-06-2019
  •  | 
  •  

Domanda

Come posso spostare un gruppo di Active Directory in un'altra unità organizzativa utilizzando Powershell?

cioè.

Vorrei spostare il gruppo "Dipartimento IT" da:

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

A:

  (CN=IT Department, OU=Temporarily Moved Groups, DC=Company,DC=ca)
È stato utile?

Soluzione

Il tuo script era davvero vicino alla correzione (e apprezzo molto la tua risposta).

Il seguente script è quello che ho usato per risolvere il mio problema:

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

Altri suggerimenti

Non l'ho ancora provato, ma questo dovrebbe bastare..

$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)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top