UNIX Script to query Active Directory: give cn (NT login name) and receive mail (Email address)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX Script to query Active Directory: give cn (NT login name) and receive mail (Email address)
# 1  
Old 05-18-2010
UNIX Script to query Active Directory: give cn (NT login name) and receive mail (Email address)

Hi folks

I need to write UNIX script (with ldapsearch) to query Active Directory. Input is NT login name and output is Email address.

Attached a screenshot of Sysinternals "AD Explorer". I need to do the same in CLI.

Image

I am absolute LDAP/ldapsearch noob.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Forum Support Area for Unregistered Users & Account Problems

Further to my query re: failed attempt to change email address on existing account

Neo Thanks for your reply to my original post, entitled "Problem changing the email address associated with my unix.com account". I am unable to reply to you in that thread, as I am unable to log-on to unix.com! From what you said about purging dormant accounts, it is likely that my account... (1 Reply)
Discussion started by: irb
1 Replies

2. Proxy Server

Solaris 11.1 login authenticate with windows active directory

Hi, is that possible to login to solaris 11.1 authenticate with windows active directory? the user id is created in the windows active directory. Environment: Solaris 11.1 Windows 2012 Active Directory (3 Replies)
Discussion started by: freshmeat
3 Replies

3. Shell Programming and Scripting

Run a script when I receive an email

Hi expert I wish to start a shell script when I receive an email. I modified the aliases file and I add this string as400nag: "|/home/nag-script/startstop/AS400-Boot.sh The solution works . When the as400nag user receive an email the /home/nag-script/startstop/AS400-Boot.sh starts .but... (3 Replies)
Discussion started by: emi65
3 Replies

4. Red Hat

How to change sender email address in mail -s command

Just having trouble trying to figure out what the option is. When I do mail -s "Subject" someuser@example.com I can't seem to specify "from" or "sender" option as I need it for my task. I tried using --f or -f though it didn't work. Can someone please tell me what other option... (0 Replies)
Discussion started by: rockf1bull
0 Replies

5. Shell Programming and Scripting

keep mail command active inside a script on unix

well, I have a script with this code inside: nohup /usr/sbin/auditstream | /usr/sbin/auditselect -m -e "event== USER_Create || event== USER_Remove || event== USER_Change || event== GROUP_Create || event== GROUP_Remove || event== GROUP_Change || event== PASSWORD_Change " | /usr/sbin/auditpr -h... (4 Replies)
Discussion started by: iga3725
4 Replies

6. Shell Programming and Scripting

I could not receive the mail sent from the unix server using 'mailx'

Hi All, I have sent a mail to my gmail id using the below command. echo " " | mailx -s "sub" myid@gmail.com I didn't get any error notification. But still I didn't receive that mail still.. please help me to learn how to send mail to other provider (Yahoo/gmail) from unix server.... (1 Reply)
Discussion started by: little_wonder
1 Replies

7. UNIX for Dummies Questions & Answers

I can send but cannot receive mail with unix?

Hi all, First post! I have just discovered that I can use unix to send mail to a mail address. I normally use entourage for my mail. This unix mail is very intriguing to me, but something is not working... I tried the search, but could not find the answer... This works: (in terminal)... (1 Reply)
Discussion started by: bjorn
1 Replies

8. Shell Programming and Scripting

how to know if the mailx command really sends the mail to the email address?

Hi guys, I have a question about the returning message of the mailx command. if I run a mailx command, how can I know if the email has been sent to the email address? If the email address doesn't exist, is there any error message returned? If yes, how can I get the error message? Thanks... (3 Replies)
Discussion started by: sheenshine
3 Replies

9. UNIX for Dummies Questions & Answers

Receive e-mail on unix box

Hi, I am not sure if it is a good question or not. Is there a unix utility which can be configured with exchange server and then receive e-mails? Thanks! (4 Replies)
Discussion started by: DejaVu
4 Replies
Login or Register to Ask a Question
Net::LDAP::Extra::AD(3) 				User Contributed Perl Documentation				   Net::LDAP::Extra::AD(3)

NAME
Net::LDAP::Extra::AD -- AD convenience methods SYNOPSIS
use Net::LDAP::Extra qw(AD); $ldap = Net::LDAP->new( ... ); ... if ($ldap->is_AD || $ldap->is_ADAM) { $ldap->change_ADpassword($dn, $old_password, $new_password); } DESCRIPTION
Net::LDAP::Extra::AD tries to spare users the necessity to reinvent the wheel again and again in order to correctly encode password strings so that they can be used in AD password change operations. To do so, it provides the following methods: METHODS
is_AD ( ) Tell if the LDAP server queried is an Active Directory Domain Controller. As the check is done by querying the root DSE of the directory, it works without being bound to the directory. is_ADAM ( ) Tell if the LDAP server queried is running AD LDS (Active Directory Lightweight Directory Services), previously known as ADAM (Active Directoy Application Mode). As the check is done by querying the root DSE of the directory, it works without being bound to the directory. change_ADpassword ( DN, OLD_PASSWORD, NEW_PASSWORD ) Change the password of the account given by DN from its old value OLD_PASSWORD to the new value NEW_PASSWORD. This method requires encrypted connections. reset_ADpassword ( DN, NEW_PASSWORD, OPTIONS ) Reset the password of the account given by DN to the value given in NEW_PASSWORD. OPTIONS is a list of key/value pairs. The following keys are recognized: force_change If TRUE, the affected user is required to change the password at next login. For this method to work, the caller needs to be bound to AD with sufficient permissions, and the connection needs to be encrypted. AUTHOR
Peter Marschall <peter@adpm.de<gt> COPYRIGHT
Copyright (c) 2012 Peter Marschall. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2013-12-23 Net::LDAP::Extra::AD(3)