Sign in to follow this  
Followers 0
azz_kikr

help: install an app with several passwords/paswor

7 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Add this somewhere at the top.

Opt("RunErrorsFatal", 0)

A suggestion:

This doesn't look very clear: if @error <> 0 Then

Change it to this:

if @error Then
Edited by SlimShady

Share this post


Link to post
Share on other sites

Be careful when trying that much passwords on an account. You could lock the admin account.

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@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

Share this post


Link to post
Share on other sites

Oops. This is really embarassing since I wrote the remarks section for the RunAsSet docs  :">

<{POST_SNAPBACK}>

thanks guys that fixed it

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  
Followers 0