Jump to content

Authentication using autoit

Recommended Posts

  • Developers

Something like this should do it: (i have posted it a few times before)

$oMyError = ObjEvent("AutoIt.Error", "ComError")
; Check Valid User/Password and optionally in a group 
Func UserValidate($domain, $UserName, $Password, $InGroup="")
    Local $NameSpace = ObjGet("WinNT:")
; Check the userid/password combination and on error return a 0
    Local $DomObj = $NameSpace.OpenDSObject("WinNT://" & $domain , $UserName, $Password, $ADS_SECURE_AUTHENTICATION)
    If @error <> 0 Then Return 0
; Optionally check the group membership
    If $InGroup <> "" Then
        $objUser = ObjGet("WinNT://" & $Domain & "/" & $UserName)
        For $oGroup in $objUser.Groups
            If $oGroup.Name = $InGroup Then 
                Return 1
        Return 0
    Return 1
;COM Error function
Func ComError()
    If IsObj($oMyError) Then
        $HexNumber = Hex($oMyError.number, 8)
    Return 0
EndFunc  ;==>ComError
Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
Live for the present,
Dream of the future,
Learn from the past.

Link to comment
Share on other sites

  • 7 months later...

Yeah, omg Larry and Jos, way to drop the ball, guys. What were you thinking?!


Edited by JRowe
Link to comment
Share on other sites

Well what I was asking was not really on an example script which I did see, but a purpose. It returns a 1 or a 0 so I was seeing how this could be useful. I guess I was just wanting to see if anyone used it in a particular way other than just what the OP asked for.

Ok this is not a dumb question. :) As I was testing it with different things, since it uses the domain policy it will lock you out after so many tries. Anyway to say how many times you have tried to autheticate? So if you have input boxes and you've tried twice. You can put, this is your 3rd or 4th attempt?


EndFuncAutoIt is the shiznit. I love it.
Link to comment
Share on other sites

  • 6 months later...

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

  • Recently Browsing   0 members

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