Prerequisite Search Done by Custom Executable not working - Advanced Installer Community
HobartSimms
Posts: 14
Joined: Wed Feb 26, 2020 7:03 pm

Prerequisite Search Done by Custom Executable not working

Hi -
I'm following the instructions here:
https://www.advancedinstaller.com/user- ... files.html

According to the docs:
"Search done by a custom executable - this option enables you to specify your own EXE file that will determine whether the prerequisite is installed. The setup will interpret the result based on the return code of your EXE. In case of the EXE finds a suitable version of the prerequisite, the returned value must be 0. Any other value will be interpreted as failure."

This is the setup:
adv1.PNG
adv1.PNG (30.86 KiB) Viewed 17576 times
Testing the command (for my own sanity), showing the command evaluates properly:
adv2.PNG
adv2.PNG (9.71 KiB) Viewed 17576 times
Yet, every time AI runs, it tried to install all the updates that are already installed - yes, these are already installed, I'm 100% certain.
adv3.PNG
adv3.PNG (15.95 KiB) Viewed 17576 times
Any idea what's going on here?
Edit: version is 17.3, please don't ask me to change the version, this is the version we use globally.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Prerequisite Search Done by Custom Executable not working

Hello,

I've tested your scenario with 17.3 version of Advanced Installer and it works as expected.

To list the installed hotfix, please run the below command

Code: Select all

wmic qfe get hotfixid
Now, in Advnaced Installer I have something as this:

Code: Select all

/c "wmic qfe get hotfixid | findstr ^"KB4569751^""
Here's how it looks like:
Capture.PNG
Capture.PNG (51.48 KiB) Viewed 17560 times
If the hotfix is registered then the prerequisite is not scheduled for installation. If the hotfix is missing, then the prerequisite is corectly scheduled for installation.

Can you please test this once again?

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
HobartSimms
Posts: 14
Joined: Wed Feb 26, 2020 7:03 pm

Re: Prerequisite Search Done by Custom Executable not working

As you can see in the photos from my initial post, I have the same settings as you.
However, I re-ran the search to prove that I'm not crazy (installed hotfixes):
adv-2a.PNG
adv-2a.PNG (18.36 KiB) Viewed 17554 times
AI still wanting to install the already installed updates. Please note: the two you see unchecked are found using a different method (registry keys present).
However, the registry keys method is very time consuming and prone to error. I would like to avoid using it if at all possible.
For whatever reason, the results of the search by cmd.exe are not being interpreted correctly:
adv-2b.PNG
adv-2b.PNG (18.11 KiB) Viewed 17554 times
HobartSimms
Posts: 14
Joined: Wed Feb 26, 2020 7:03 pm

Re: Prerequisite Search Done by Custom Executable not working

I sent the AIP file, let me know if there is anything else I can do.
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Prerequisite Search Done by Custom Executable not working

Hello Chris,

The issue here is that the condition is always evaluated as false, because your search results in a failure.

The reason for that is the syntax you have used. Please note that quotes characters are not necessary when doing the search.

If you open a run command (WIN+R) and try your command, you will notice that it will return nothing.

A correct command line will look as it follows:

Code: Select all

cmd.exe /c wmic qfe get hotfixid | findstr "KB4528760"
Therefore, you do not need to encapsule this line:

Code: Select all

/c wmic qfe get hotfixid | findstr "KB4528760"
in quotes, neither in or outside of Advanced Installer.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
HobartSimms
Posts: 14
Joined: Wed Feb 26, 2020 7:03 pm

Re: Prerequisite Search Done by Custom Executable not working

Hi, thanks for replying.
As you can see from my first post (please refer to the command line image), the argument was processing correctly when run manually. You'll notice the error level under each.
Regardless, I changed the quotes in the AI arguments as per your suggestion. It did not work. I still get the same result. For whatever reason, A.I. seems to be misinterpreting the return code from cmd.exe.
HobartSimms
Posts: 14
Joined: Wed Feb 26, 2020 7:03 pm

Re: Prerequisite Search Done by Custom Executable not working

I think I found the problem:
Peculiar cmd.exe should have tipped me off
Peculiar cmd.exe should have tipped me off
cmd.PNG (7.69 KiB) Viewed 17482 times
I noticed a peculiar cmd.exe file being included in the package after build. Rather than use the systems cmd.exe, A.I. was trying to include its own copy. Of course the system would have none of that, and not allow the included cmd.exe to run. I was under the impression that A.I. would try to use the system cmd.exe, not include a copy.

What I did as a workaround was make a simple little bat file:

Code: Select all

@echo off
wmic qfe get hotfixid | findstr %1
IF %errorlevel% equ 0 (EXIT /B 0) ELSE (EXIT /B 1)
It seems to be working this way, but I still have more test cases to run.
bat.PNG
bat.PNG (5.13 KiB) Viewed 17482 times
What I can say, is the prescribed method I showed in my first post did not work for me on W10, W8.1, S2012 R2, S2016, or S2019.
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Prerequisite Search Done by Custom Executable not working

Hello Chris,

First of all, please ignore my last thread.

I have done some tests right now and it should be working as you have used it, too. I am not quite sure what happened back then when I was testing but somehow the search always failed.

Please accept my apologies for this.

I have to admit I am completely baffled here. I really can not tell what is happening.

Before going any further, I am glad you finally got this working.

However, I am afraid we still did not found the root cause for this and this is quite bothering. Hopefully, with some more help we will be able to figure out what is going on.
I think I found the problem:
This may not be the problem here.

The reason you see that cmd.exe is because of your package type which is "EXE with resources next to it". If you double click on it and run the command that retrieves the hotfix IDs, you will see that everything works as expected.

For the moment, I really can not tell why this is happening.

Please allow me some more time to further investigate this and I will followup on this thread as soon as I find anything that may help.

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

Return to “Common Problems”