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...