bickyz
Posts: 8
Joined: Tue May 12, 2020 6:42 pm

Acrobat X - Wrap msi with multiple files & change HKLM registry

Hi, We have Acrobat X installation package with
1 x msi file
1 x msp file
1 x Data1.cab
1 x en_GB.mst
few xml, setup.ini, png files

I using following scripts to deploy it

Code: Select all

msiexec.exe /i AcroPro.msi EULA_ACCEPT=YES REGISTRATION_SUPPRESS=YES SUITEMODE=1 INSTALLLEVEL=101 AS_DISABLE_LEGACY_COLOR=1 IGNOREAAM=1 TRANSFORMS=en_GB.mst /qn
After deploying, I run following PowerShell script to make changes to the registry

Code: Select all

Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" -Name "AdobeAAMUpdater-1.0"
Remove-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run" -Name "Acrobat Assistant 8.0"
Remove-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run" -Name "Adobe Acrobat Speed Launcher"
Remove-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run" -Name "Adobe ARM"
How can I wrap all the installation files + installation script + registry changes in one msi file.

Any help would be much appreciated, thank you.
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: Acrobat X - Wrap msi with multiple files & change HKLM registry

Hello and welcome to our forums,

To do so, you can create a new Advanced Installer project and add the MSI file as a prerequisite (in "Prerequisites" page).

After doing so, you can add the additional files of your prerequisite in the "Additional Files" field from your prerequisite ("Prerequisites" page --> "Setup Files" tab)

In what regards the script, you can add it as an "Inline PowerShell script" custom action.

You can schedule this custom action in the "Custom Actions" page, after the "Add Resources" action group (in the "Install Execution Stage").

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
bickyz
Posts: 8
Joined: Tue May 12, 2020 6:42 pm

Re: Acrobat X - Wrap msi with multiple files & change HKLM registry

Hi Catalin,
Thank you for the guide.

PowerShell to remove the registry items has to be done after the Adobe has completely finished installing and also it requires admin privilege as it is deleting the keys on HKLM hive. In the "PowerShell Inline Script", do I need to select "After the system has been successfully modified (commit)" & "Run under the LocalSystem account with full privileges (no impersonation)" ?

Also do I have to tick "Run as administrator" on "Install Parameters" ?

Once I build the package as "Single MSI", do I simply run msiexec /i AI-AdobeX.msi /qn for the silent installation ?
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: Acrobat X - Wrap msi with multiple files & change HKLM registry

Hello,
PowerShell to remove the registry items has to be done after the Adobe has completely finished installing and also it requires admin privilege as it is deleting the keys on HKLM hive.
Indeed, you are right here. In order to modify the registries, one must have administrative privileges.

First of all, in order to run a setup silently, the command line from which the MSI is launched should be run elevated. Therefore, I do not think the "Run as administrator" option is required here.

In what regards the "Run under the LocalSystem account with full privileges (no impresonation)" option, yes, please check it.

Now back to the root. You have mentioned that:
do I simply run msiexec /i AI-AdobeX.msi /qn for the silent installation ?
That is indeed the command to run a package silently.

However, we may have a little problem here.

When the main package is run silently, the feature based prerequisite is treated as a post install prerequisite - meaning it is installed at the end of the installation. In this case, unfortunately, it is not possible to run our PowerShell script after the prerequisite installation is done (at least not from the main package).

Fortunately, there is something we can do here. Since the prerequisites are installed in the order specified in the "Prerequisites" page, we can simply create a new project in Advanced Installer in which we add our script, build it and add the MSI as a prerequisite, scheduled after the installation of our main prerequisite.

Basically, here we have created a bootstrap MSI that is only used to run our script. Additionally, in order to avoid this bootstrap MSI to appear in the Control Panel, you can go to "Product Details" page and uncheck the "Register product with Windows Installer" option.

Also, it would be nice to execute this bootstrap MSI silently, so it doesn't spawn any more UI to the user. To do so, modify its "Install Command Line" fields from the "Prerequisites" page --> "Setup Files" tab to install silently.

Attention: The above change should be done in the main package's "Prerequisites" page, not in the boostrap MSI's "Prerequisites" page.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
bickyz
Posts: 8
Joined: Tue May 12, 2020 6:42 pm

Re: Acrobat X - Wrap msi with multiple files & change HKLM registry

Thank you Catalin.

I have created a PS script only project & added Custom Action\PS Inline script, then pasted the PS scripts there. Build it as AcrobatPS.msi
Then modified the main application project with AcrobatX as prerequisite and added the above Actobat.msi as second prerequisite along with the /quiet /norestart on Full/Basic/Silent command lines.
Then build it as MainApplication.msi & performed the silent installation with "msiexec.exe /i MainApplication.msi /quiet /norestart"

All went well and software installed successfully plus the PS scripts ran, however the main installation has created a folder inside C:\Program Files (x86) called "Your Company\MainApplication" and "Your Company2\AcrobatPS", Is there anyway to delete these at the end ?

When the main package is run silently, the feature based prerequisite is treated as a post install prerequisite - meaning it is installed at the end of the installation. In this case, unfortunately, it is not possible to run our PowerShell script after the prerequisite installation is done (at least not from the main package).
In regards to above, just curious to know, If I run the main application normally (non-silently), I guess the order of install will be:
Prerequisite Adobe Acrobat
Custom Action PS Inline script
Main application

Howevever, if I run the main package silently, the feature based prereq is treated as post install. So is this the order of the post install ?
Main application
Custom Action PS Inline
Prerequisite Adobe Acrobat

If I build the package as EXE & run silently, will it still treat the feature based prereq as post install ?

Once again, thank you very much for your help.
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: Acrobat X - Wrap msi with multiple files & change HKLM registry

Hello,

Awesome news! I'm glad to hear that everything works as expected.
All went well and software installed successfully plus the PS scripts ran, however the main installation has created a folder inside C:\Program Files (x86) called "Your Company\MainApplication" and "Your Company2\AcrobatPS", Is there anyway to delete these at the end ?
Perhaps you can delete them from your PS Script. Since the PS Script is the last one that executes.

In what regards the installation order, you are right. The prerequisites are ran in the specified order.

If the main package is run silently --> the order of the feature based prerequisites is:

Main --> Prereq1 --> Prereq2

If the main package is run with UI, the order is:

Prereq1 --> Prereq2 --> Main

The reason for this is the following:

The feature-based prerequisites are installed right when you press the "Install" button (right before the main package installation). This is done to avoid the "Another installation is already in progress" error.

However, if the main package is ran silently, there is no UI that is displayed, therefore this is no longer possible.
If I build the package as EXE & run silently, will it still treat the feature based prereq as post install ?
Yes, the behavior is the same in this case.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
bickyz
Posts: 8
Joined: Tue May 12, 2020 6:42 pm

Re: Acrobat X - Wrap msi with multiple files & change HKLM registry

Thank you Catalin.

Instead of "PowerShell Inline Script" if I use "PS Script File" and place the PS file in the "Target Computer\Application Folder", how do I remove the PS file along with the Application folder at the end ?
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: Acrobat X - Wrap msi with multiple files & change HKLM registry

Hello,

If the script is added as a file (not inline), then you can add (in the package that contains the script) another custom action (scheduled after your script) that will remove the APPDIR folder, together with the script file.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
bickyz
Posts: 8
Joined: Tue May 12, 2020 6:42 pm

Re: Acrobat X - Wrap msi with multiple files & change HKLM registry

Hi Catalin,
Thank you for your support.

Can I use simple PS script like this to delete the APPDIR & the .ps1 file or there is a proper AI variable ?

Code: Select all

Remove-Item -Recurse "C:\Program Files (x86)\Your Company" -Force -Confirm:$false
Remove-Item -Recurse "C:\Program Files (x86)\Your Company2" -Force -Confirm:$false

Ealier I have mentioned that creating a PS script MSI (abAdobeCS6-PS.msi) and adding it as prerequisite to the main-application, then running "msiexec.exe /i MainApplication.msi /quiet /norestart" went successfully (AcrobatX got installed & PS script did the job) with no errors. However when I run in non-silent mode by double-clicking the MainApplication.msi, I am getting an error "Warning 4154: abAdobeCS6-PS prerequisite was not correctly installed. Continue with installation of Your Application ?". While the error was on the screen I quickly checked it by going through file explorer/registry/programs & features and I can see AcrobatX has been installed, plus PS script did the job as well. So not sure what this error was about when everything ran successfully.

While error was on the screen, following two folders exists
C:\Program Files(x86)\abAdobeCS6-PS
c:\users\xx\Roaming\Your Company

Clicked Yes on the error, installation completed successfully dialog screen came up. Following two folders still there.
C:\Program Files(x86)\Your Company
C:\Program Files(x86)\abAdobeCS6-PS

Clicked No on the error, setup ended prematurely dialog screen came up.
C:\Program Files(x86)\abAdobeCS6-PS - this folder still exist
C:\users\xx\Roaming\Your Company - this folder removed

Image
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: Acrobat X - Wrap msi with multiple files & change HKLM registry

Hello,
Can I use simple PS script like this to delete the APPDIR & the .ps1 file or there is a proper AI variable ?
The answer to this is yes, and yes. The cmdlet that removes a file is indeed the "Remove-Item" cmdlet.

In what regards your second question, yes, that is also possible. In your script, you can get the values of public properties. In our case, we need to retrieve the value of APPDIR since that is the directory we want to remove. To do so, you can proceed as it follows:

Code: Select all

$var = AI_GetMsiProperty APPDIR
This will take the value of APPDIR and store it in the $var variable.

After doing so, the script may look as it follows:

Code: Select all

Remove-Item -Recurse "$var" -Force -Confirm:$false
In what regards this:
I am getting an error "Warning 4154: abAdobeCS6-PS prerequisite was not correctly installed. Continue with installation of Your Application ?".
This might happen due to your prerequisite's conditions. Please keep in mind that the conditions are evaluated twice:

- once before the installation. Here, the conditions must be false ==> the prerequisite will be installed

- once after the installation. Here, the conditions must be true ==> the prerequisite was correctly installed. Otherwise, the setup will think that the prerequisite was not correctly installed and it will spawn a message, like in your case.

This does not necesarily mean the prerequisite was not correctly installed, it is just a logic inserted by you in the main package to double check the installation.

As you can see, this is the case here (you have checked and the prerequisite was correctly installed, however you are still receiving the error).

With that being said, please double check the condition of your prerequisite and make sure it is evaluated as true after the installation of the prerequisite. To do so, please go to "Prerequisites" page --> your prerequisite --> "Install Conditions" tab.

A little example so we can better understand this. Let's consider your prerequisite does something unique only to it. For instance, let's consider that it writes a .txt file to C:\ directory.

In the "Install Conditions" tab, the condition is a search for that file.

- before the installation of the prerequisite, the main setup will look for that file. Here, the setup will see that the file is not present (the condition is false), therefore it will install the prerequisite

- after the installation, it will check again if the file is present. Now, the file should be present (the condition should be true). If it is present, it will interpret this as a success and will continue with the installation. Otherwise, it will interpret this as a failure.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
bickyz
Posts: 8
Joined: Tue May 12, 2020 6:42 pm

Re: Acrobat X - Wrap msi with multiple files & change HKLM registry

Thank you Catalin.
This does not necesarily mean the prerequisite was not correctly installed, it is just a logic inserted by you in the main package to double check the installation.
Where in main package do I find this logic ?


All of my prerequisites Install Conditions has
Install perquisite based on conditions
Criteria: Product Version (identify by Upgrade Code)
Search String: {DDCC0F54-4D3A-4039-96DB-7F74E293A567}

Is there a way I can disable the Install Condition check ? If I use "Always install perquisite" will it avoid that error ?
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: Acrobat X - Wrap msi with multiple files & change HKLM registry

Hello,
Where in main package do I find this logic ?
This can be found in the "Prerequisites" page --> your prerequisite.

You can disable the post-install condition by selecting your prerequisite --> "Properties" tab --> check the "Continue with main installation even if the prerequisite is not installed".

This way, the check after the prerequisite is installed will no longer be done.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
bickyz
Posts: 8
Joined: Tue May 12, 2020 6:42 pm

Re: Acrobat X - Wrap msi with multiple files & change HKLM registry

thank you Catalin for the support.
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: Acrobat X - Wrap msi with multiple files & change HKLM registry

You are always welcome!

I am glad I was able to assist.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”