Jump to content

help: install an app with several passwords/paswor


 Share

Recommended Posts

i have to isntall certain apps on on like 500 computer now there are several differect admin accout/passwords. Can any1 point me into the right diretion on how to craete ceratin script.

i got his far but it always gives me a incorrect password/username error and it doesnt try the other passwords

any help will be appreciated

$TMPDIR = "d:\Test"
$ALLUSERSPROFILE = EnvGet ( "ALLUSERSPROFILE")
dim $Administrator[4]
dim $Paswoord[3]

$Administrator[0] = String("Administrator")
$Administrator[1] = String("Admin")
$Administrator[2] = String("Administrateur")
$Administrator[3] = String("Beheerder")
$Paswoord[0]= String("pasword")
$Paswoord[1]= String("test")
$Paswoord[2]= String("test2")
dim $LoginOk

$SourceDir = "\\xx.xx.xx.xx\Anonymous\"
$AppName = "apps.exe"

InstallServer()

;Einde
Exit

Func InstallServer()
DirCreate ( $TMPDIR & "\" & "Temp" )
FileCopy ( $SourceDir & $AppName, $TMPDIR & "\Temp\", 1)

for $i = 0 to 3
    for $j = 0 to 2
        Runasset($Administrator[$i], @computername, $paswoord[$j])
        runwait($TMPDIR & "\" & "Temp\" & $AppName)
        if @error <> 0 Then
            MsgBox(16, "Error Logon", "Unable to logon. " & $LoginOk & $Administrator[$i] & $paswoord[$j] & @computername )
            else
            MsgBox(64,"Wheee","Yes" & $LoginOk & $Administrator[$i] & $paswoord[$j] & @computername )
            runwait($TMPDIR & "\" & "Temp\" & $AppName)
            exitloop 2
        endif
    Next
Next
Runasset()          

    
;Sleep ( 2000 )
;DirRemove ( $TMPDIR & "\" & "Temp", 1)

EndFunc
Link to comment
Share on other sites

Runasset($Administrator[$i], @computername, $paswoord[$j])
 runwait($TMPDIR & "\" & "Temp\" & $AppName)

You need to check the return value (or is it @error flag?) of the RunAsSet BEFORe calling RunWait. If RunAsSet fails, the runwait could potentially hang.

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

@Cyberslug:

Did you check the RunAsSet documentation?

Return Value

Returns 0 if the operating system does not support this function.

Otherwise returns 1--regardless of success. (If the login information was invalid, subsequent Run/RunWait commands will fail....)

That's why they implemented the option RunErrorsFatal.

So @error is set when the Run* function fails.

Edited by SlimShady
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...