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