0 votes

I've tried using the business container creation script and looping a foreach and I've been getting errors on the SetInfo part, just wondering what I'm doing wrong.

by (100 points)

1 Answer

0 votes
by (294k points)

Hello,

It is not possible to comment on that without viewing the script and the errors. At the same time, it should work just fine if the CSV file has the required details in it. The following article will be helpful: https://adaxes.com/sdk/ManagingBusinessUnits.

0

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?

0

Hello,

To achieve the desired, replace this line in the script

$myBusinessUnit.Description = $container.description

with the below one

$myBusinessUnit.Put("description", $container.description)
0

Wow, fantastic, that worked. Thank you so much for your help!

Related questions

0 votes
0 answers

I am trying to find a way to create Groups based off an OU and a list of options (check boxes) within the portal For example: Select the Target OU to add groups ... 3 - Remote Administrators Option 3 - Remote Developers Option 4 - Readers Option 4 - Writers

asked Sep 11, 2020 by dknapp (100 points)
0 votes
1 answer

I am trying to trigger processing outside of Active Directory when an account is created based on the source user account that was used. Does Adaxes store the source account anywhere?

asked Oct 9, 2023 by jnordell (20 points)
0 votes
1 answer

I'd like to be able to either send an email report or export a CSV of all of the business rules carried out when a user is disabled. This would be ... Management Activity section but this includes things that weren't part of the disable operation. Thanks

asked Feb 19, 2020 by bavery (250 points)
0 votes
1 answer

Hi, would it be possible to script a workstation in AD and also directly from our local SCCM environment ?

asked Oct 28 by ddesmedt (40 points)
0 votes
1 answer

For example, if their old password was "Password1", if they try to change it to "Password2" it would block the password reset since it doesn't meet the password requirements.

asked Sep 10 by tsinball (20 points)
3,588 questions
3,277 answers
8,303 comments
548,079 users