DSC Package Resource is Ignoring Argument

Tagged: , ,

This topic contains 5 replies, has 3 voices, and was last updated by Profile photo of Arie H Arie H 3 weeks, 6 days ago.

  • Author
    Posts
  • #67009
    Profile photo of Mike Robertson
    Mike Robertson
    Participant

    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.

  • #67110
    Profile photo of Arie H
    Arie H
    Participant

    Use TARGETDIR instead 🙂

    • #67138
      Profile photo of Mike Robertson
      Mike Robertson
      Participant

      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.

  • #67465
    Profile photo of Missy Januszko
    Missy Januszko
    Participant

    Looks like this works:
    Arguments = 'INSTALLDIR="C:\Tools\7Zip"'

    • #67488
      Profile photo of Mike Robertson
      Mike Robertson
      Participant

      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.

  • #67569
    Profile photo of Arie H
    Arie H
    Participant

    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

You must be logged in to reply to this topic.