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

Is it possible to add a user to a group based on hardware ? There are users with a Windows device and a MacOS device. I want to be able to choose this when ... the user via Adaxes and automatically link them to a specific group based on the chosen hardware.

asked Apr 16 by Cas (200 points)
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

Hello. I got a script that when E-mail forwarding is set, it automatically sends an email to the person that will recieve the forwarded emails for 6 months. But I'd like ... what to put in the xxxxxxx so it would take the account that im running command on.

asked Jun 3 by EdgarsABG (110 points)
3,548 questions
3,238 answers
8,232 comments
547,813 users