Jump to content
Sign in to follow this  
wisem2540

Prompt for AD Username and password

Recommended Posts

wisem2540

I see there is a Active Directory UDF and I see that Water is working on enhancements.  I would like to do something very simple  Prompt for a username, and password in a specific group.  If it passes authentication, great, if not, then exit.  But I do not understand where to start.

Share this post


Link to post
Share on other sites
JLogan3o13

What are you trying to do with the authentication attempt (Open a file/dir, log into a remote machine, etc.)? Prompting for the username and password can be done easily enough with either a couple of InputBoxes or a small GUI, but the twist will come in what you're trying to accomplish (keeping in mind, as well, whatever lockout policies your domain has in place).


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
wisem2540

Scenarios:

Member of Group and Bad Password  = Error message and exit

Good Password Not Memeber of Group = Error about group and exit

Good Password, Good Group - Continue Script

Share this post


Link to post
Share on other sites
JLogan3o13

I'm not sure what enhancements Water is working on, but I have used this in the past to test for authentication. Again, be mindful of your corporate lockout policies.

pwCheck("Jim-Bob", "Password1", "myCompany.com")

Func pwCheck($Name, $Password, $Domain)
    Const $ADS_SECURE_AUTHENTICATION = 1

    $oAD = ObjGet("WinNT:").OpenDSObject("WinNT://" & $Domain, $Name, $Password, $ADS_SECURE_AUTHENTICATION)
        MsgBox(0, $Domain & "\" & $name, @error)
EndFunc

√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
wisem2540

That works just fine.  I looked up the command, and I do not see a way for it to support group memberships

Edited by wisem2540

Share this post


Link to post
Share on other sites
JLogan3o13

You would need to combine it with another function, such as _AD_IsMemberOf. I would suggest this (pseudo):

  • declare your vars (domain, username, pw, group)
  • call a single function passing those vars
  • Execute _AD_IsMemberOf first (if this fails, no need to test authentication and potentially lock the account)
  • If successful, move on to the next item.

√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
water

JLogan3o13 provided the perfect solution!

As I'm not working on any enhancements for the AD UDF at the moment there is only one way to check the userid/password. Pass the credentials to _AD_Open. With the enhanced error checking you can tell that the user provided a invalid passwort or whatever.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
wisem2540

Thanks for the feedback guys.  After looking over the UDFs, this is more trouble than its worth. 

Most UDFs are just one au3 file with several functions.  The AD zip I downloaded had 86 AU3 files in it.  One for every function.

 

I can simply create a password and code it into the app.

Edited by wisem2540

Share this post


Link to post
Share on other sites
JLogan3o13

JLogan3o13 provided the perfect solution!

As I'm not working on any enhancements for the AD UDF at the moment there is only one way to check the userid/password. Pass the credentials to _AD_Open. With the enhanced error checking you can tell that the user provided a invalid passwort or whatever.

 

Geez, should have thought of that. So much more simple :>


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
water

Most UDFs are just one au3 file with several functions.  The AD zip I downloaded had 86 AU3 files in it.  One for every function.

You only need AD.au3 in your script!

All other files are example scripts, help files etc.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
wisem2540

Water,

Thanks, I actually just noticed that this morning, and have since gotten AD Authetincation working!  I wanted to stop by and thank everyone for their help again. 

Share this post


Link to post
Share on other sites
water
:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
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  

×