Deleting Organizational Units
The following code sample deletes an Organizational Unit.
- ADSI
-
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi") # Connect to the Adaxes service $admNS = New-Object("Softerra.Adaxes.Adsi.AdmNamespace") $admService = $admNS.GetServiceDirectly("localhost") # Bind to the Organizational Unit $ouDN = "OU=My OU,DC=domain,DC=com" $ou = $admService.OpenObject("Adaxes://$ouDN", $NULL, $NULL, 0) # Delete the Organizational Unit $ou.DeleteObject("ADM_DELETEOBJECTFLAGS_AUTO")
- PowerShell
-
Import-Module Adaxes $identity = "OU=My OU,DC=domain,DC=com" # DN # $identity = "{EB5FEB21-E648-42AD-B86C-89D3C6807953}" # GUID Remove-AdmOrganizationalUnit -Identity $identity -Recursive -Server "domain.com" ` -AdaxesService localhost -Confirm:$False