DSC Package Resource is Ignoring Argument

There was a recent discussion about the Package resource and arguments, but I’ve run into a new (and baffling) problem. I’m using the Package resource to install 7-Zip on a server. Here is the relevant part of my configuration:

So here’s the wild part - this doesn’t technically fail. 7-Zip installs successfully, and DSC is completely happy. The problem is, it gets installed to the default folder of C:\Program Files\7-Zip rather than C:\Tools\7Zip where I told it to. It’s as if the argument I included is completely ignored. Here’s the portion of the output when it runs

VERBOSE: [SERVER01]: [[Package]SevenZip] Starting process C:\WINDOWS\system32\msiexec.exe with arguments /i “C:\Installs\7Zip\7zip-x64.msi” /quiet INSTALLDIR=C:\Tools\7Zip
VERBOSE: [SERVER01]: [[Package]SevenZip] The machine requires a reboot
VERBOSE: [SERVER01]: [[Package]SevenZip] Package has been installed
VERBOSE: [SERVER01]: [[Package]SevenZip] Package configuration finished
VERBOSE: [SERVER01]: [[Package]SevenZip] in 0.9850 seconds

If I copy and paste the command it supposedly ran in line 1 into a PowerShell window, it works as expected with 7-Zip installing to C:\Tools\7Zip, so I know the argument itself is correct.

Has anyone run into something similar? Do I need to format my argument differently? I tried including escaped double-quotes around the install path itself, but it had the same result.

Use TARGETDIR instead :slight_smile:

That’s a good call, but unfortunately it had the same result. The configuration worked successfully, but the application still installs in the default path.

Looks like this works:
Arguments = ‘INSTALLDIR=“C:\Tools\7Zip”’

That’s not working for me, unfortunately. This is so bizarre!

The one thing I haven’t considered, though, is the fact that the target directory doesn’t already exist. I didn’t think that was really necessary for an application install since most of them can just create the directory they need, but I’m going to try to explicitly have DSC create it and then depend this install on it.

UPDATE: Nope, that didn’t do it either. I’m just going to work around this because it’s not worth fighting with any more. I’m sure it’ll leave a bug for my future replacement, but I’ll try to document it as best I can.

Am not able to test it atm, but on similar note you might want to try escaping the double quotes
something like this:

INSTALLDIR=‘"C:\Tools\7zip’"

ill consider adding /q or /qn varieties to make it silent as it might be failing on the fact a OK/Cancel window pops up and this isn’t an interactive session