Moving groups
The following code sample moves a group from one organizational unit to another.
- ADSI
-
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi") # Connect to the Adaxes service $ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace" $service = $ns.GetServiceDirectly("localhost") # Bind to the target OU $targetOUDN = "OU=TargetOU,DC=domain,DC=com" $targetOU = $service.OpenObject("Adaxes://$targetOUDN",` $null, $null, 0) # Move group $groupPath = "Adaxes://CN=SalesGroup,CN=Groups,DC=domain,DC=com" $targetOU.MoveHere($groupPath, $null)
- PowerShell
-
Import-Module Adaxes $identity = "CN=SalesGroup,CN=Groups,DC=domain,DC=com" # DN # $identity = "{EB5FEB21-E648-42AD-B86C-89D3C6807953}" # GUID $targetOUDN = "OU=TargetOU,DC=domain,DC=com" Move-AdmObject -Identity $identity -TargetPath $targetOUDN ` -Server "domain.com" -AdaxesService localhost