Bug in Get-FileVersion -ProductVersion

Hi,
I’ve noticed in PSADT version 3.10.1 that Get-FileVersion with the -ProductVersion parameter will return the version with extra whitespace at the end for the unins000.exe for what looks like software packaged using INNO Setup.
Some examples are:

  • TreeSize Free 4.7.3 by JAM Software
  • Reope Toolbox 1.7.3
  • PyRevit 4.8.13

It looks like the cause of this is the product version set by INNO Setup, so this isn’t actually a bug in Get-FileVersion (or Get-Command, which Get-FileVersion calls) and has been mentioned on their forums already https://groups.google.com/g/innosetup/c/wJZ4RQKsxq8/m/TW27JaR1CQAJ

If you have an affected .exe you can reproduce this with

$aa = Get-FileVersion -File "<path to file>" -ProductVersion
"+$aa+"
$aa = Get-FileVersion -File "C:\Program Files\JAM Software\TreeSize Free\unins000.exe" -ProductVersion
"+$aa+"
[06-18-2024 17:52:38.617] [Execution] [Get-FileVersion] :: Getting version info for file [C:\ProgramData\Reope\Toolbox\unins000.exe].
[06-18-2024 17:52:38.625] [Execution] [Get-FileVersion] :: Product version is [1.7.3                                             ].
+1.7.3                                             +

Since it’s returned as a string anyway a possible fix/workaround would be to add this line after line 7240 in AppDeployToolkitMain.ps1
Before

                If ($fileVersion) {
                    If ($ProductVersion) {

After

                If ($fileVersion) {
                    $fileVersion = $fileVersion.Trim()
                    If ($ProductVersion) {

Cheers,
John

EDIT: added PSADT version, changed suggested fix

2 Likes

FYI: The best place to report a bug or issue with PSADT is via the Github issues page:

1 Like

Good to know, I’m not too familiar with Github so will brush up and start using it :slight_smile:

Issue has been logged on Github

2 Likes

Looks like a fix has already been made based on your finding, so, subject to testing I guess this fix will find it’s way into a future patch (or full) release

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.