You can run any command line you want via the execute or script resources like powershell_script (http://docs.chef.io/resource_execute.html or http://docs.chef.io/resource_powershell_script.html).
The downside of resources like this is that unless the underlying commands are idempotent by nature, you’ll need to put a guard in place (http://docs.chef.io/resource_powershell_script.html#guards) to check if the resource really needs to run. You’ll likely even want to use a guard even if the command you are executing is idempotent by nature, otherwise it will report running that resource every time chef applies that recipe.
Using something like windows_package from the windows cookbook (https://supermarket.chef.io/cookbooks/windows) will let you use a nullsoft (or other) installer in an idempotent fashion. You can pass arbitrary options as well via the options attribute.
Community Software Development Engineer @ Chef
Microsoft MVP - PowerShell
On 5/5/2015 10:42:48 PM, Sean Farrow firstname.lastname@example.org wrote:
reThanks for this, is the a way of running any executable with command line arguments?
From: Matthew Moretti [mailto:email@example.com]
Sent: 05 May 2015 15:41
Subject: [chef] Re: Re: Running an executable with commandline arguments on windows
The windows_package resource from the Windows cookbook [https://supermarket.chef.io/cookbooks/windows] also supports an installer type of :nsis (Nullsoft Scriptable Installer System) and states in the README:
For proper idempotence the resource’s package_name should be the same as the ‘DisplayName’ registry value in the uninstallation data that is created during package installation. The easiest way to definitively find the proper ‘DisplayName’ value is to install the package on a machine and search for the uninstall information under the following registry keys:
That is, the provider will check for uninstall data in the Registry and not install the package again if it finds it. Seems like that should do what you want.
On Tue, May 5, 2015 at 8:50 AM, Benjamin Micucci <firstname.lastname@example.org [mailto:email@example.com]> wrote:
I’m not sure if there’s a windows command line argument for idempotency, however within your resource you can add a “not_if file exists” (not the correct syntactic btw) & just check to see if the folder created within Program Files or whatever the default location is for your executable exists. If the folder exists, it won’t install again.
Hope this helps,
Sent from my iPhone
On May 4, 2015, at 10:52 PM, Sean Farrow <firstname.lastname@example.org [mailto:email@example.com]> wrote:
I’m in a situation where I need to run an executable (a nulsoft installer fyi) to install a product silently on windows.
What is the best way of running an executable with commandline arguments so the install is idempotent?