Jump to content

Need help with AdFind.exe redirection


Recommended Posts

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!

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

Glad to be of service :oops:

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...