Jump to content
Sign in to follow this  

RunAswait - Retry Password

Recommended Posts

Using the example I build the script below:

What i try to get done:

Execute Function RunAsWait use password 1 when password is incorrect RunAsWait use password 2.

But currently the script reports a msgbox on the first attempt: The username or password is incorrect.

any tips?


Func Setup()
    ; Username and password to the appropriate values for your system.
    Local $sUserName = "SystemAdmin"
    Local $sPassword1 = "Syst123!"
    Local $sPassword2 = "System123!"

    ; Run Cmd and wait for process to close. CMD is run under the user pecified.
    Local $ifirst = RunAsWait($sUserName, @ComputerName, $sPassword1, $RUN_LOGON_NOPROFILE, @ScriptDir & ".\AltirisSetup\EC_SMA.cmd", "", @SW_HIDE)
    If @error Then
       Local $iSecond = RunAsWait($sUserName, @ComputerName, $sPassword2, $RUN_LOGON_NOPROFILE, @ScriptDir & ".\AltirisSetup\EC_SMA.cmd", "", @SW_HIDE)
       Local $iSecond = -1
    If @error Then
        Local $sLastError = _WinAPI_GetLastErrorMessage()
        MsgBox($MB_SYSTEMMODAL + $MB_ICONERROR, "Error", "Installation Failed Contact Administrator" & @CRLF & @CRLF & $sLastError)
        ; Display the return code of the process.
        MsgBox($MB_SYSTEMMODAL, "", "installation Successed. First:"& $ifirst &", Second:"& $iSecond)
EndFunc   ;==>Setup



Share this post

Link to post
Share on other sites

Welcome Patrick,

No sure I understand completely what you are saying : Is the messagebox , you talk about, displayed by the shelled process or by AutoIt3?


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.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...