Frage

Wie bewege ich eine Active Directory-Gruppe in einer anderen Organisationseinheit mit Powershell?

dh.

Ich mag die Gruppe „IT-Abteilung“ bewegen, aus:

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

zu:

  (CN=IT Department, OU=Temporarily Moved Groups, DC=Company,DC=ca)
War es hilfreich?

Lösung

Ihr Skript wirklich nahe war zu korrigieren (und ich schätze Ihre Antwort wirklich).

Das folgende Skript ist, was ich verwenden, um mein Problem zu lösen.

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

Andere Tipps

ich dies noch nicht versucht haben, aber das sollte es tun ..

$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)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top