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 (288k 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

Hi all, I've created a 'View User' command via the Web Interface Configurator. I don't want users to be able to make any changes, so I've created a Custom ... there any way to remove this, short of removing the entire Exchange section itself? Thanks, David

asked Sep 5 by dshortall (80 points)
3,538 questions
3,229 answers
8,224 comments
547,748 users