win_package with no path in 2.3.2

I’m currently using Ansible 2.3.2, and I want to uninstall a program from a group of computers. According to the UninstallString from the registry, it just uses msiexec /x with a certain product ID. Therefore, I’d think it should be very trivial to uninstall using win_package.

However, my problem is that the program that was installed didn’t come with an MSI and I can’t find any MSIs for it within the filesystem. I did, however, confirm that msiexec can uninstall the program with the ProductID.

Since it requires a path, I was hoping that using an arbitrary path (in this case to a binary that would do nothing when called) it might work, but it doesn’t seem to do the trick. Here’s what I tried:

`

win_package:
path: ‘C:\Windows\System32\rundll32.exe’
product_id: ‘{7D7C80AF-58D6-4C3F-912B-8B5B4D50A71B}’
state: absent

`

However, that didn’t seem to do the trick. What would be my best bet here?

Hi

The win_package module was overhauled in 2.4 and it now allows you to uninstall a package when you just specify the product id. In the end you should be able to run just

  • win_package:
    product_id: ‘{7D7C80AF-58D6-4C3F-912B-8B5B4D50A71B}’
    state: absent

This works the way you describe, when you don’t specify a path it tries to find the UninstallString in that key. If it exists it should just run msiexec.exe /x {7D7C80AF-58D6-4C3F-912B-8B5B4D50A71B} /qn /norestart. You can always add the newer version of the module but putting it in your ANSIBLE_LIBRARY path. The URL for the newest version is https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/windows/win_package.ps1, otherwise you can just check out the latest devel version and try it from there.

Thanks

Jordan