Creating business units
The following code sample creates a business unit.
[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 'Business Units' container
$businessUnitsPath = $service.Backend.GetConfigurationContainerPath("BusinessUnits")
$businessUnitsContainer = $service.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()
For information on how to specify membership rules for a business unit, see Modifying membership rules.
See also
- Managing business units
- Binding to Adaxes-specific objects
- Managing Adaxes-specific objects
- IADs
- IADsContainer
- IAdmBusinessUnit
- Online script repository