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 (40 points)

1 Answer

0 votes
by (277k 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

A little bit of context: There are 3 departments that share 1 Active Directory. Now each department has its own OU. I would like to have an email sent when a user is ... if this is possible without Powershell? If not, is there a pre-existing script for this?

asked Oct 3, 2023 by Cas (150 points)
0 votes
1 answer

We have a process that when a new user is created they are emailed their username and apssword. If the user is in an Admin Group they are then sent an email with some PDFs ... you can send emails, but am unable to see where it could attach files to the email?

asked Sep 3, 2020 by dknapp (100 points)
3,408 questions
3,105 answers
7,899 comments
545,795 users