Jump to content

Verify username and password


Recommended Posts

Hi all,

Is there anyway to verify that a username and password is valid using Auto-It. I have my users enter a domain\username and password using InputBox, but I wanted to know if there is way to verify this is a valid username and password?

Any help would be greatly appreciated. Thanks.

-- If the apocalypse comes... beep me.

Link to comment
Share on other sites

$User = InputBox('User', 'Enter User name')
$Domain = InputBox('Domain', 'Enter Domain name')
$Pass = InputBox('Password', 'Enter Password', '', '*')

MsgBox(0, 'Test User Account', _CheckUserPass($User, $Pass, $Domain))

Func _CheckUserPass($sUsername, $sPassword, $sComputerName)
    Local $iCheck = True
    
    Opt("RunErrorsFatal", 0)
    RunAsSet($sUsername, $sComputerName, $sPassword, 0)
    Run(@ComSpec & " /c  echo checking password...", @TempDir, @SW_HIDE)
    If @error Then $iCheck = False
    RunAsSet()
    Opt("RunErrorsFatal", 1)
    Return $iCheck
EndFunc

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

$User = InputBox('User', 'Enter User name')
$Domain = InputBox('Domain', 'Enter Domain name')
$Pass = InputBox('Password', 'Enter Password', '', '*')

MsgBox(0, 'Test User Account', _CheckUserPass($User, $Pass, $Domain))

Func _CheckUserPass($sUsername, $sPassword, $sComputerName)
    Local $iCheck = True
    
    Opt("RunErrorsFatal", 0)
    RunAsSet($sUsername, $sComputerName, $sPassword, 0)
    Run(@ComSpec & " /c  echo checking password...", @TempDir, @SW_HIDE)
    If @error Then $iCheck = False
    RunAsSet()
    Opt("RunErrorsFatal", 1)
    Return $iCheck
EndFunc
This looks pretty nice. Thanks.

Now if I am on computer 1, and want to check if the domain\username and password are local admins on computer 2. Is there an AutoIt way? I know there is a VBScript way to do this, but I'd like to keep everything in AutoIt.

-- If the apocalypse comes... beep me.

Link to comment
Share on other sites

This looks pretty nice. Thanks.

Now if I am on computer 1, and want to check if the domain\username and password are local admins on computer 2. Is there an AutoIt way? I know there is a VBScript way to do this, but I'd like to keep everything in AutoIt.

Well autoit support COM is just to convert the vbs script into autoit.
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
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...