Alright, I’ll start of saying that on previous installs I’ve done of the free version of Avast I’ve ran it with the /silent switch and let it install Chrome and then uninstalled it afterwards(or just left it, depending on user preferences).
However, today I decided to remedy the problem.
I started by reading up on the web for known switches/solutions to the problem, but all I could find was to either let Chrome install then uninstall it, OR kill the Chrome installer when it launches and delete any files it created - none of which in my opinion is a really proper solution.
Therefore I decided to come up with a better solution (in my opinion at least), and I started by looking at how the installer handles the install (what switches, files, etc. it was using).
My main method was to analyze the installer using Process Explorer, Process Monitor, and to some minor extent IDA Pro and Olly Debug - the last two to examine what switches where handled by the executables.
Using Process Explorer, I could clearly see that the installer was executing an otherwise non-executable file(due to it missing the .exe file extension) called avast.setup, I confirmed what it was doing using Process Monitor, which also showed me that the installer was extracting some files (including the avast.setup file) to a temporary directory (located inside %temp%).
I then had a look at the switches the “Main” installer was launching the “Real” installer (avast.setup) with, and found it was using these switches:
/sfx /sfxstorage "<temp directory>" /GetEdition:free /brandcode "A" /srcpath "<directory of Main installer>" /sfxname "<name of Main installer>"
refers to the directory the “Main” installer extracted files to (in my case %temp%_av_sfx.tm~).
refers to the directory where the Main installer was located.
refers to the filename of the “Main” installer ( in my case avast_free_antivirus_setup)
I then proceeded with copying the files the installer extracted to a place for studying them in peace sorta speak. (at this point I canceled the install since I was going to redo it without Chrome being part of the install).
Do note, that if the install is canceled, the temporary directory is deleted, so be sure to copy the files before closing the installer!
Looking at the files inside the copied directory, I found a lot of vpx files, along with some binaries, such as dlls, and two executables:
GToolbar_AVS.exe and
Chrome_AVS.exe
I guessed these two were responsible for both the Toolbar and Chrome installation(which happens by default in silent mode), so I renamed them (one could just remove them as well, but I kept them).
I also had a look at the avast.setup file, and (based on previous experience with installers (and even a few games) I know that an executable file does NOT need the .exe file extension to in fact be executable, so I tried adding .exe to its name, giving me avast.setup.exe.
Then I tried running the newly renamed file as it was, and somewhat expectedly this gave me an error window from the installer, no dice.
I decided to try and run it with the switches the default installer ran it with, and it gave me more errors, again no dice.
I then had a closer look at the switches, and noticed that two switches stood out, namely /sfxstorage and /srcpath.
Since I had copied the files the “Main” installer extracted, the path to said files obviously had changed, so I rewrote the switches so they pointed to the new path of the files.
Running it again with correct file paths fixed the issue and the installer popped right back up as if run from the “Main” installer (it was still showing the option of installing Chrome and its Toolbar).
I canceled the install yet again, and added the /silent switch to the mix, and after a few minutes I had Avast installed, WITHOUT Chrome!
Success at last.
To sum it up, what I did was to look in the %temp% directory for files copied by the installer, then backing these files up to a new folder, then renaming/removing the Chrome related executables, and renamed the “hidden” installer executable from avast.setup to avast.setup.exe, changed the switches to point to the folder where the backed up files now resided and added the /silent switch.
The full command line became:
C:\Avast\Setup\avast.setup.EXE /sfx /sfxstorage "C:\Avast\Setup" /GetEdition:free /brandcode "A" /srcpath "C:\Avast" /sfxname "avast_free_antivirus_setup" /silent
Note:
Even though some of the switches point to the directory of the “Main” installer executable, and the name of the executable, it does seem the “Main” installer executable is NOT needed, only the extracted files are.
I have not thoroughly tested this to see that no complications arise from it, but it definitely seems to work.
All this was done on a networked virtual machine running a freshly installed domain joined PC with Windows 7 Ultimate 64-bit through Remote Desktop.
I hope this will help somebody out there!