Jump to content
Sign in to follow this  
bbocker

Need help with AdFind.exe redirection

Recommended Posts

bbocker

Hi,

It seems like a simple thing, but I cannot figure this out:

All I need to do is Run AdFind.exe from an AutoIT script and save the results to a file. Apparently AdFind.exe does not have a built-in option to save output to a file, so what is used is file redirection like this example:

Adfind.exe -nodn -f proxyAddresses:=smtp:JOHNDOE@somedomain.com > results.txt

So far the best I have been able to accomplish is running AdFind.exe and noticing the results on the screen, but they are never "redirected" (saved, output) to a file.

I have tried everything I can think of with AutoIT commands but I am having no luck. I tried searching these forums (usually very helpful!) but no luck.

Anyone know how to get this to work using AutoIt? Seems like it should be such a simple thing?! Thanks for any help!

Share this post


Link to post
Share on other sites
water

You want a list of all users where property proxyAddresses is set to "JOHNDOE@somedomain.com"?

You don't need ADFind. Use my Active Directory UDF (for download please check my signature), it has all you need.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
bbocker

Water,

If I run Adfind.exe -nodn -f proxyAddresses:=smtp:JOHNDOE@somedomain.com > results.txt from the command line I get back results like this:

>cn: DOE, JOHN

>sn: DOE

>c: US

>l: CITY

>st: STATE

>title: MR

>description:

>postalcode:

>telephonenumber:

>... etc, etc

plus it will give me all the >proxyaddresses:smtp information.

Do you have an example of how to get that information and save it to a file with your UDF? I would be very happy to use it instead of AdFind if it will give me the information I need! Thanks for your help!

Share this post


Link to post
Share on other sites
water

Something like this should do what you want:

#include <AD.au3>
_AD_Open()
$aArray = _AD_GetObjectsInOU("", "(proxyaddresses=SMTP:JOHNDOE@somedomain.com)",2,"samaccountname,distinguishedname")
If @error then
    MsgBox(16, "", "No record found or error occurred. @Error: " & @error)
Else
    _Arraydisplay($aArray)
EndIf
_AD_Close()

If you need all properties for the user you can get them by

$aProperties = _AD_GetObjectProperties($aArray[1])

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
bbocker

Water,

Your solution works great! I already tested it and have it up and running. It is much better for my purposes than using AdFind and completely solves my problem. I don't know how I missed your UDF before when I was searching?!?

Anyways, thanks a bunch!

Share this post


Link to post
Share on other sites
water

Glad to be of service :oops:


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×