0 votes
  • Short question:

I have a Powershell script that is generating some information and saving it to a SQL table. Is there some way to save that information into a field in AD using Adaxes?

  • Long question:

In our job, we have an internal program that needs a unique username in a specific format. So, the AD username cannot be this value. I am currently generating the username and placing it in the needed SQL table using a Powershell query in Adaxes, but that means we need to view/query the table manually to get the result. We've been placing the special username manually in the "Office" field.

Ideally, I would be able to store this username in some field in AD as an action, either during or directly after the initial Powershell query. I don't mind making a few actions if needed to do this.

Basically, our current workflow is:

  1. Make the user in Adaxes
  2. Powershell runs and generates their special, unique username
  3. Someone manually checks the table for what uername it is and places the name into AD in the "Office" field manually
  4. Someone then emails the name to the user and their manager manually

What we would like is:

  1. Make the user in Adaxes
  2. Powershell runs and generates their special, unique username
  3. Some other automated action takes that username (from the prevous query or from the SQL table) and places it in the "Office" field of AD
  4. Automated email sends this value to the user

Let me know if you need more information. I know how to take an AD item and place it in Powershell using Adaxes, but I don't know how to go the opposite way basically. Thanks!

by (100 points)

1 Answer

0 votes
by (289k points)
selected by
Best answer

Hello,

It should work fine using a PowerShell script in a business rule triggering After creating a user. The script will query your SQL database, generate the required unique value and save it to the Office property. Unfortunately, we do not have the exact script, but the following one from our repository should be helpful: https://www.adaxes.com/script-repository/check-whether-employee-id-is-present-in-sql-database-s10.htm.

0

I'm having trouble seeing where in that query it is storing the generated value in AD? I'm new to Powershell so I may be misunderstanding.

I can see where it is comparing the SQL result to an existing value in AD, but I'm not trying to compare to an existing AD value, rather, I am trying to assign a new value to an AD feild.

Let me know please, thank you!

+1

Hello,

The script we referenced does no update AD properties. It was just an example you can use as base. To update a property of the target object, you can use the below code in Adaxes scripts. The $propertyName variable represents the schema name (not display name) of the property to update. For example, if you want to update the Office property, the variable must be set to physicalDeliveryOfficeName exactly like in the example.

$propertyName = "physicalDeliveryOfficeName" # TODO: modify me

$Context.TargetObject.Put($propertyName, "<value to set for the property>")
$Context.TargetObject.SetInfo()
0

That worked immediately and perfectly, thank you so much!

Related questions

0 votes
1 answer

I had a script that would copy the values from adm-CustomAttributeTextMultiValue1 and save them into extensionAttribute15 as a comma seperated list. The script somehow got deleted and I can't seem to find the tutorial I used to create it before.

asked Jul 1, 2022 by jordan (110 points)
0 votes
1 answer

I created a group Business Rule that triggers "After adding or removing a member from a group". On its Activity Scope I added a test group, and set it for "The group ... does not trigger. What should I do to make the BR detect this (admittedly rare) case?

asked Mar 16, 2023 by alex.vanderwoude (60 points)
0 votes
1 answer

The checkbox is not selected (False) by default.

asked May 30, 2022 by john.harding (70 points)
0 votes
1 answer

Hello - I have configured some custom property patterns for office location and Department and am seeing a drop down list when attempting to create a new user limited to the ... down list. Is this therefore only limited to some AD attributes and not others ?

asked Mar 21, 2017 by cdsouza (50 points)
0 votes
1 answer

Hi, is it possible to save to an Adaxes attribute the value of the last Sign In from Azure AD? When we query users for Last Logon, we, of course, can only see the Last Logon value from AD It would be very useful to know the latest login in Azure AD as well

asked Jun 22, 2020 by manuel.galli (100 points)
3,548 questions
3,239 answers
8,232 comments
547,814 users