win_package product_id

I am currently going through and installing all of the various software that is needed to provision our windows 7 machines. Unfortunately, when I attempt to install the latest Anaconda3 from continuum, I am unable to locate that products guid (product_id). It doesn’t appear in the normal registry locations for 64 or 32 installs, in the wmic.exe get product powershell output or under a Get-ChildItem Win32_Product powershell output as well.

I generated a guid, but after the program installed it failed since it was unable to locate the product_id to see if it was installed (the error was basically, the program appeared to install correctly, but it was unable to located the product_id).

Since the product_id is required for this module is there anything I can do? I double the win_msi package would work due to the face that the anaconda3 installer is a installshield exe.

I currently have a version by repackaging the exe as a msi in AdminStudio, but that isn’t ideal.

Cheers

Take a look at your registry path HKLM:\Software\microsoft\windows\currentversion\uninstall.

Each installed package should register there, and I think the idea is that guids should be used, but as you can see from the software installed on my machine some packages just use the package name:

So, if I for instances wanted to create an ansible play for installing android studio, I would simply used productId “Android Studio”.

If the software you want to install doesn’t register itself under the uninstall registry path there’s not much you can do with win_package, as it requires a registry-based lookup to firugre out if the software is already installed or not. You could possibly test of the installed files are already present and then do win_script to install the package in a more manual way maybe. In any case, win_package requires that the installed software plays nicely and registers itself in the uninstall path.

Interesting. So following your advice, the value in HKLM:\Software\microsoft\windows\currentversion\uninstall is Python 3.5*.1 (Anaconda3 2.5.0 64-bit)* and lets say we run:

  • name: install conda
    win_package:
    path: ‘.\Desktop\CondaInstall.exe’
    product_id: ‘Python 3.5.1 (Anaconda3 2.5.0 64-bit)’
    arguments: “/S /D=…\Anaconda3”

When the package is already installed, the task executes as expected and reports no change in state.
When the package is not installed, one would expect for the package to be installed. Instead, the module fails and reports the $LocalizedData.PostValidationError

  • Package from {0} was installed, but the specified ProductId and/or Name does not match package details

It seems to be failing somewhere around Line 925 in win_package with the Get-ProductEntry in the Set-TargetResource function. The odd thing is, when I pull out Validate-StandardArguments and Get-ProductEntry functions, they act as expected. i.e.

  • Validate-StandardArguments ensures that the path exists, reports that the product_id is not a guid and sets the $identifyingNumber to the product_id.
  • Get-ProductEntry then takes the parsed $identifyingNumber form Validate-StandardArguments and returns the $keyLocation for the product_id (either 32bit or 64bit uninstall registry keys)
  • Set-TargetResource then tests the resource, notices that the installer is an exe and starts the process as requested by the supplied arguments. After install the function should then check if the $Ensure state is set to ‘Present’ (default condition), then it checks to see if the value returned from Get-ProductEntry exists (program was installed.
    Unfortunately, it fails to install the exe. I did notice that the process briefly appears in the task manager, then immediately following the failure notice from ansible, drops away. Perhaps the process fails to correctly start with the correct arguments?

Is this a package which is publicly available? I’d like to have a closer look.

It is:

Python 3.5 64bit
https://www.continuum.io/downloads