Jump to content

Authenticate with Active Directory


Lew
 Share

Recommended Posts

search the forum first ;)

I've been looking around the forums but can't fine what I am looking for yet but just want to see if anybody had something I could look at that they might have came across. :):)

Link to comment
Share on other sites

What do you want to do exactly?

If you just want to check a given userid/password against the AD then you will find some solutions on the forum.

Or you could use this tool.

If you run Windows 7 you could use the latest version of my AD UDF (for download please see my signature). Just call _AD_Open() with userid/password and check the return code.

This function is not yet available in version 0.39. If you want to test it I will send you the latest version.

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

For the current user this would look like:

#include <AD.au3>
If _AD_Open() <> 1 Then
  MsgBox(0,"AD","Error " & @error " returned by _AD_Open.") ; Invalid userid/password etc.
  Exit
Endif
If _AD_IsMemberOf("Group") = 1 Then
  MsgBox(0,"AD","User is member of group xx")
  Exit
Endif
_AD_Close()

If you are running Windows 7 you get more information if the userid/password is invalid, account is locked etc.

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

For the current user this would look like:

#include <AD.au3>
If _AD_Open() <> 1 Then
  MsgBox(0,"AD","Error " & @error " returned by _AD_Open.") ; Invalid userid/password etc.
  Exit
Endif
If _AD_IsMemberOf("Group") = 1 Then
  MsgBox(0,"AD","User is member of group xx")
  Exit
Endif
_AD_Close()

If you are running Windows 7 you get more information if the userid/password is invalid, account is locked etc.

Thanks, I was thinking about that last night some how using _AD_Open and _AD_IsMemberOf. It will be running on XP but will have to play around with those functions and see what I get out of them.
Link to comment
Share on other sites

For the current user this would look like:

#include <AD.au3>
If _AD_Open() <> 1 Then
  MsgBox(0,"AD","Error " & @error " returned by _AD_Open.") ; Invalid userid/password etc.
  Exit
Endif
If _AD_IsMemberOf("Group") = 1 Then
  MsgBox(0,"AD","User is member of group xx")
  Exit
Endif
_AD_Close()

If you are running Windows 7 you get more information if the userid/password is invalid, account is locked etc.

Water - Question for you. I am running this under WinXP. _AD_Open ( "Username", "Password")

If I use this with the correct password or wrong password, I receive a value of Success - 1 and @error of 0. Is that because I am running this under WinXP?

Link to comment
Share on other sites

Is that because I am running this under WinXP?

Correct. Windows XP is not very good in returning useful error information.

You can either use the test version of the enhanced _AD_Open. Or you can wait for version 0.40 of the UDF which will be released in the next 2-3 weeks.

Both functions set @error = 8 on Windows XP if the userid or password is invalid.

On Windows 7 you get an error array and @error is set to the Windows32 error code of the last LDAP function call.

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

Correct. Windows XP is not very good in returning useful error information.

You can either use the test version of the enhanced _AD_Open. Or you can wait for version 0.40 of the UDF which will be released in the next 2-3 weeks.

Both functions set @error = 8 on Windows XP if the userid or password is invalid.

On Windows 7 you get an error array and @error is set to the Windows32 error code of the last LDAP function call.

Thanks water, That test version worked for me.
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...