Ask Your Question

Uninstalling programs in windows that are less than X version

asked 2016-09-22 03:46:46 -0600

itaremyinitials gravatar image

updated 2016-10-07 13:07:37 -0600

Hi puppeters,

I am working on some puppet manifests to manage windows machines, and so , for a while I was installing 7zip -for example- using this method:

package { '7-Zip 9.20 (x64 edition)': - ensure => installed, - source => '', - provider => 'windows' - }

Now I have changed that, so chocolatey will be managing this install . -The thing here- is; I want to change my puppet manifest to remove the 7zip old version (no matter what old version is that, because I am managing a big number of machines), I thought to try matching with a regex any package that has a version less than ‘7zip' but that turned up too complicated , is there any way i can achieve the same goal with less effort , (Also I know that i can do the same with a batch file), but i want a more cleaner solution to that.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2016-10-06 12:48:33 -0600

joshc gravatar image

You should be able to specify the MSI PackageCode as the title of the resource:

package { '<package code>':
  ensure => absent,
  source => '...',
  provider => windows

See for info about how to get the package code for a given MSI.

edit flag offensive delete link more


This is definitely one way to do it!

rob gravatar imagerob ( 2016-10-07 13:05:14 -0600 )edit

answered 2016-10-07 13:07:13 -0600

One option is the one that joshc mentioned. Another is that Chocolatey is moving towards supporting the ability to uninstall software it doesn't manage as packages (licensed versions). This is something you will be able to take advantage of in Puppet manifests with a simple switch in the uninstall_options.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-09-22 03:46:46 -0600

Seen: 116 times

Last updated: Oct 07 '16