0 votes

Hi,

I am currently working on an interface that allows our HR tool to create users in Adaxes. I got the whole thing to work up to that point where I want user creation to be moderated. That's where it gets complicated...

I have implemented a adm-CustomAttributeDate so we can time a deprovision, so we don't have to click the deprovision button on the last day of work of our employees. The adm-CustomAttributeDate gets read by a scheduled task every evening and deprovisions all users with a date older than today. This works like a charm so far!

If I want to change that adm-CustomAttributeDate on an existing user then there isn't much of an issue. I can just do this:

$admUser.("adm-CustomAttributeDate1") = $lastWorkDay
Set-AdmUser -Instance $admUser -AdaxesService "localhost"

According to the privileges of my user that runs my interface to the HR tool, this change needs to be moderated (which works fine as well).

If I need to create a new user through my interface I run the following code (shortened to better readability):

$newAdmUser = [PSCustomObject]@{
   #all kinds of args
   "adm-CustomAttributeDate1" = $lastWorkDay
}
$newAdmUser | New-AdmUser -AdaxesService "localhost" -Path $UserBaseOU

The user gets created but the adm-CustomAttributeDate1 won't be set. Is there a way to set this attribute on user creation?

The reason why I need to do it this way is that I want to moderate / approve the user creation. If I just set the attribute after creating the user as mentioned in the change in the first code snippet then everything would work fine without the approval process. But when using the approval process it obviously won't find the user as it has not yet been created at that point...

by (100 points)

1 Answer

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

Hello Yannik,

You should use the OtherAttributes parameter to specify a value for the adm-CustomAttributeDate1 attribute. For details, see http://www.adaxes.com/sdk/?New-AdmUser.html.
The command should look like the following:

$newAdmUser | New-AdmUser -AdaxesService "localhost" -Path $UserBaseOU -OtherAttributes @{'adm-CustomAttributeDate1' = $lastWorkDay}
0

Hi,

Ah, I forgot about that... Tried using it with a different approach where I couldn't implement that "OtherAttributes" switch for some reason. It works now though! Thank you for your help :-)

Related questions

0 votes
1 answer

Hello again, I created granular rights for users and allowed only specific attributes to be written. In the webGUI, the edit works fine, the fields without write rights ... to those attributes without removing those from the create form? Thank you in advance

asked Jul 9, 2013 by Pierre (750 points)
0 votes
1 answer

How do you add a custom attribute to the search results? Version 2017.2 / 3.8.14823.0

asked Nov 12, 2018 by hgletifer (1.3k points)
0 votes
1 answer

Is it possible to script having users added (or removed) from a Security Group based on another AD Attribute? I have found ways to do this in Powershell (something like): ... just utilize the PS script and just run it through Adaxes on a timed fashion? Thanks!

asked Oct 7, 2014 by PunkinDonuts (360 points)
0 votes
1 answer

We have a single AD domain that also matches our primary email domain (e.g. @primarydomain.com), but we also have multiple company specific email domains (e.g. @companydomain. ... like to also link the companydomain.com to the user's company value set in AD.

asked Apr 29, 2020 by JacquesKruger (20 points)
0 votes
1 answer

We would like to have a business unit that is based on an adaxes custom attribute. I don't see a way of doing this. Do you all have any ideas?

asked May 18, 2020 by mark.it.admin (2.3k points)
3,326 questions
3,026 answers
7,727 comments
544,681 users