0 votes

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 to send an email to said forwarding reciever 1 month before the 6 month timer is done. For that i made a seperate automation, that has a script.

My question is - how to set CustomAttributeText35 within a powershell command to the user on which the command is executed on?

image.png

# Email settings
$bodyText = $Null
$subject = "Forwarding from deprovisioned user."
$bodyHtml = "text"

$userReciever = $Context.BindToObjectByDN("%param-delegateForwarding%")

try
{
    $userRecieverEmail = $userReciever.Get("mail")    
}
catch
{
    $Context.LogMessage("The user specified in parameter 'MyParameter' has no email address. ", "Information")    
}

# Send mail
$Context.SendMail($userRecieverEmail, $subject, $bodyText, $bodyHtml)

Ive tried to use

Set-AdmUser xxxxxxxxxxxx -Replace @{"adm-CustomAttributeText35"="$userRecieverEmail"}

But i cant figure out what to put in the xxxxxxx so it would take the account that im running command on.

by (110 points)

1 Answer

+1 vote
by (279k points)
selected by
Best answer

Hello Edgar,

how to set CustomAttributeText35 within a powershell command to the user on which the command is executed on?

You will need to use exactly the below code:

$Context.TargetObject.Put("adm-CustomAttributeText35", $userRecieverEmail)
$Context.TargetObject.SetInfo()

The following article will be helpful: https://adaxes.com/sdk/ServerSideScripting.

Set-AdmUser xxxxxxxxxxxx -Replace @{"adm-CustomAttributeText35"="$userRecieverEmail"}

For details on using the cmdlet, have a look at the following article: https://adaxes.com/sdk/Set-AdmUser. Pay attention to parameters -AdaxesService and -Identity.

Adaxes custom attributes are not availble in any other tools. As such, you can only retrieve or set them using cmdlets with the -AdaxesService parameter specified.

0

Thank You! Worked perfectly!

Related questions

0 votes
1 answer

Is there any way to add a warning message when someone tries to add a group member that already is member? Checked config but found nothing related. Added a new member that ... the group and there is no warning, and the logs show that the task was completed.

asked Jul 9 by lramirez (20 points)
0 votes
1 answer

Is it possible to to get all users with a custom attribute defined? In PowerShell I'd be doing this: $s = get-aduser -filter 'Description -like "Sales Engineer"' | Select ... -like "True"' | Select Name Is this possible? Thanks for any help or tips!

asked Aug 7, 2018 by jake_h (300 points)
0 votes
1 answer

I am wanting to export a list of users including the properties of a specific custom attribute. Ideally, I would be able to run a get-admuser and filter on a custom attribute, but even an excel report with the custom attributes would work. Is this possible?

asked Sep 9, 2021 by ggallaway (300 points)
0 votes
1 answer

Hello, we cannot delete users with adminCount=1 with the buildin action "Delete the user" because of missing (adminSDHolder)permission to delete users as ... $identity = "%distinguishedName%" Remove-AdmUser -Identity $identity -Confirm:$False regards Helmut

asked Nov 17, 2020 by a423385 (510 points)
0 votes
1 answer

Hello, I need to check, from a csv file, if users exist or not. I do not have the login name but only the atributs Name givenName The output must be another csv file ... " --> False or True Is there an Adaxes script existing doing this? Thanks in advance!

asked Feb 4, 2019 by tentaal (1.1k points)
3,434 questions
3,130 answers
7,984 comments
546,353 users