cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jstarbird
Level 5

method to get MSI filename from within same MSI

I am looking into the possibility of using a method where after building the MSI the filename is changed to match a customer Id. Then I'd like to be able then take that filename and use it during the install process but I need to be able to get the MSI filename when that same MSI is running. I know I can pass params and such but for the circumstance I'm trying to cover that is not possible.
I've searched but could not find a way to do this other than a FindAllFiles using the SupportDir param as the starting point. I don't like this method though because if a user happens to save the file at the Root of their drive this will search their entire drive.
I also considered FindFile but the problem here is that the user may have more than one MSI file in the location and FindFile only gives you the first one found, alphabetically.
So besides searching is there some way to get the MSI filename from within the running MSI? Remember that the name is changed post build time.


Thanks,
J
Labels (1)
0 Kudos

(2) Replies
RobertDickau
Flexera Alumni

From memory I don't know if there's a simple way. The OriginalDatabase property has the full path or URL of a running MSI, so maybe a custom action that extracts the file name from the end of the value would do it? I haven't tried it, so no promises.

KB article Q105766 mentions OriginalDatabase, and also points out that the value isn't what you might want during uninstallation, but it might be worth looking into.
0 Kudos
jstarbird
Level 5

That does the trick!

As usual Robert you're the MAN with the answers! Many thanks. This solves a big headache issue for us!
0 Kudos