I'm not sure what I did differently today but I got it to work today. It did create the containers, but I cannot set a description on them, when I run the script:
$containers = Import-Csv D:\Scripts\containers.csv
foreach ($container in $containers)
{
[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 'My Container' container
$businessUnitsPath = $service.Backend.GetConfigurationContainerPath(
"BusinessUnits")
$businessUnitsPathObj = New-Object "Softerra.Adaxes.Adsi.AdsPath"`
$businessUnitsPath
$myContainerPath = $businessUnitsPathObj.CreateChildPath("CN=Container1")
$myContainer = $service.OpenObject($myContainerPath, $null, $null, 0)
# Create business unit
$myBusinessUnit = $myContainer.Create("container", $container.container)
$myBusinessUnit.Description = $container.description
# [TODO] specify membership rules
$myBusinessUnit.SetInfo()
}
The error: The property 'Description' cannot be found on this object. Verify that the property exists and can be set.
The headers in the csv are container and description and they have the container and description under them. What is the proper attribute to set a description on a BU container?