Skip to content

Creating Business Units

The following code sample creates a Business Unit.

[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 'Business Units' container
$businessUnitsPath = $admService.Backend.GetConfigurationContainerPath(
    "BusinessUnits")
$businessUnitsContainer = $admService.OpenObject($businessUnitsPath,
    $NULL, $NULL, 0)

# Create new Business Unit
$unit = $businessUnitsContainer.Create("adm-BusinessUnit", "CN=My Unit")
$unit.Description = "My description"

$rules = $unit.GetMembershipRules()
# [TODO] specify membership rules
$unit.SetMembershipRules($rules)

$unit.SetInfo()

Tip

For information on how to specify membership rules for a Business Unit, see Modifying membership rules.

See also