0 votes

I would like to create a task to get an address from proxyAddresses (Email Proxy Addresses) and add the number to a CustomAttribute field.

The address would be DIR:xxxx (where xxxx is a 4 digit number) and I would like to add the 4 digit number to adm-CustomAttributeText5.

by (1.1k points)

1 Answer

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

Hello,

For information on how to create a Scheduled Task, see the following tutorial: http://www.adaxes.com/tutorials_Automat ... gement.htm. On step 5, add the Run a program or PowerShell script action and paste the following script:

$dirProperty = "adm-CustomAttributeText5" # TODO: modify me
$patern = "^DIR:[0-9]{4}" # TODO: modify me

function UpdateProperty($propertyName, $value)
{
    $Context.TargetObject.Put($propertyName, $value)
    $Context.TargetObject.SetInfo()
}

# Get all addresses
try
{
    $values = $Context.TargetObject.GetEx("proxyAddresses")
}
catch
{
    UpdateProperty $dirProperty $NULL
    return
}

$numbers = @()
foreach ($value in $values)
{
    if ($value -notmatch $patern)
    {
        continue
    }

    # Get numbers from address
    $numbers += $value.SubString(4, 4)
}

# Update custom attribute
if ($numbers.Length -eq 0)
{
    UpdateProperty $dirProperty $NULL
}
else
{
    UpdateProperty $dirProperty ($numbers -join ";")
}

Related questions

0 votes
1 answer

I would like users to use Adaxes to add themselves or others to a group, but instead of it just working, it has to go thru an approval process and be approved by the group owner before they are added. Thanks!

asked Jun 30, 2021 by RayBilyk (230 points)
0 votes
1 answer

Good morning, I need to get the serial number of PC and update the description with the value result. I tried with %serialNumber% but the is empty. Can u help me? thanks, Simone

asked Nov 17, 2021 by Simone.Vailati (430 points)
0 votes
1 answer

Hello, i have a custom command which sets the oof-message for the selected user. in this custom command i have a parameter "param-vertretung" (ad-object picker). Now i want to ... and email of the stand-in in the oof-message. Can you help me with that? Thanks

asked Nov 13, 2020 by lohnag (160 points)
0 votes
1 answer

Hi, we're receiving the below error when trying to add SMTP addresses to Office365 mailboxes from Adaxes. I've raised a ticket with support, but thought I'd ask ... , please see exception members for more information. Any help would be great. Thanks Gary

asked May 29, 2020 by gazoco (490 points)
0 votes
0 answers

We would like users to be able to add their mobile number and carrier information from within the web console. Preferably, they would enter their mobile number in a ... ". This address would then be written to an extensionAttribute field in Active Directory.

asked Mar 2, 2016 by Kikaida (1.1k points)
3,346 questions
3,047 answers
7,782 comments
544,982 users