Jump to content

Recommended Posts

Posted

I have a tiny script - 6 lines - that I have used before without issue.

; Script Start - Add your code below here
Local $sUserName = "UserName"
Local $sDomain = ""
Local $sPassword = "Password"
;
RunAsWait($sUserName, $sDomain, $sPassword, 0, 'msiexec /i "c:\InstallPathTo.msi"')

My older scripts that have been compiled with older versions of AutoIT install and work without issue.  Going into the .au3 file and changing it to get a new file to install with a new path, and when I compile it with the latest version, I immediately get notifications that my AV is scanning.  It does compile, but the resultant .EXE won't work.  I get a flash and then a message on the screen from Windows Installer saying that the package could not be opened.  

  • How do my old scripts and EXE files work fine, but this new/updated one will not?
  • What can I do to this one to make it function properly?

I'm actually trying to distribute a deployment app to 500~ish machines that are all islands - no domain, no centralized management - by having them download a package and then run this.

 

Posted

Thanks @Andreik - it's similar, but not the same.  I can compile the app, it just won't run when I do.  And turning off Defender on 500+ machines individually isn't going to be time-efficient... I could remote into them and install the app myself quicker than that.  I just don't get it why the newer versions get tagged as a problem and the old ones are fine.

Posted

Thanks @argumentum - I did see this on the page where Exit had his script posted.  I was trying to follow the logic of yours, but I'm a little lost.  Sorry for being a noob with this (it's not a place I work in often, I just write small BAT files for installs and things) but could you give me a quick "how-to" to convert or incorporate my script?

Posted
2 hours ago, rlake5 said:

Sorry for being a noob with this

Oh, ..that's you and me too. I don't do batch files because I use AutoIt as a batch file ( of sorts ).

The code is very friendly. The function "_extract_b64_batch_chunk()" will extract all these files that have the tag "::filename:". Adding one more file, is a matter of adding another:

...
    ; we do the same for the other file(s)
    FileWriteLine($sWorkingDir & "\" & $sBatchFileToMake, "::filename:" & $sMyScript & ".b64" & @CRLF)
    RunWait(@ComSpec & ' /c type "' & $sWorkingDir & '\' & $sMyScript & '.b64" >>"' & $sWorkingDir & '\' & $sBatchFileToMake & '"', $sWorkingDir, @SW_HIDE)
    FileWriteLine($sWorkingDir & "\" & $sBatchFileToMake, @CRLF) ; again, add a separator for, the heck of it
...

that at the end of the b64 to binary rebuilding/extraction, will run the rest of the batch file:

...
    ; then we add the run/start command, in this case autoit3.exe MyScript.au3
    FileWriteLine($sWorkingDir & "\" & $sBatchFileToMake, @CRLF & ':runThem' & @CRLF & _
            'start ' & $sAutoItExe & ' "' & $sMyScript & '"' & @CRLF)
...

May look as bit hard to wrap your head around it, but is as simple and straight forward as it can be.
Be patient with the code. What I posted here as an explanation is chunks from that same script.

I don't like the hacky idea of this solution but you only have 500 installs to do and this should work. Not that it will without a doubt but, give it a try.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted

...the batch file is just the basics, to extract the files within it and a "run" command at the end.
The rest of the cleanup ( delete the temp *.b64 files, etc. ) will have to be coded in the running script.
In the example the command starts with "start" to free the batch file and exit it ( the batch file ) but you can just execute and by the nature of it ( a batch file ) it will wait until the last command executed. Therefore, add the deletion of every file other than itself ( the batch file ) after the run command.

I bet you know these things but I wanted to clear my head :)

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

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...