0 votes

We have an AD Atturbute called HRManager which refferances AD accounts (like the manager attubute does) is there a way to get the email address of the referanced account in a script?

by (1.3k points)

1 Answer

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

Hello,

Yes, it is possible using the below script for a DN syntax property like the Manager one. In the script, the $propertyName variable specifies the LDAP name of the property.

$propertyName = "manager" #TODO: modify me

# Get the object DN
try
{
    $dn = $Context.TargetObject.Get($propertyName)
}
catch
{
    $Context.LogMessage("Property $propertyName is empty.", "Information")
    return
}

# Get object email
try
{
    $object = $Context.BindToObjectByDN($dn)
    $objectEmail = $object.Get("mail")
}
catch
{
    $Context.LogMessage("Object with DN $dn does not exist or has no email specified.", "Information")
    return
}

Related questions

0 votes
1 answer

I have a custom command that prompts for a "reporter" for our ticketing system for enabling VPN accounts. Sometimes a technician will enable an account on behalf of another ... do I extract the email address of that object chosen as a parameter? Thank you.

asked Dec 10, 2019 by bjzielinski (70 points)
0 votes
1 answer

Hello, I don't find an attribute for the netbios name of managed Domains like adm-DomainDN? How can I add the NetBios name to a report like "All users"? regards Helmut

asked Mar 5, 2021 by a423385 (510 points)
0 votes
1 answer

Hello, I'm wondering if it's possible to export a list of all users in AD along with their email addresses to an Excel spreadsheet and then schedule that export to append ... address that wasn't previously used. Please let me know if this is possible. Thanks!

asked Apr 11 by sjjb2024 (60 points)
0 votes
1 answer

Hi Is it possible to get the Web Interface address via a script? Thanks Matt

asked Oct 13, 2023 by chappers77 (2.0k 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)
3,588 questions
3,277 answers
8,303 comments
548,090 users