xPSDesiredStateConfiguration icon indicating copy to clipboard operation
xPSDesiredStateConfiguration copied to clipboard

xPackage, fixes bug preventing uninstalling software

Open raandree opened this issue 3 years ago • 7 comments

Pull Request (PR) description

Uninstalling a .exe or .msi hangs forever as the argument handling is incorrect. The Set function calls 'msiexec.exe' and adds the installation arguments to the call. As this does not work, the process hangs waiting for input.

This Pull Request (PR) fixes the following issues

Fixes #704.

Task list

  • [x] Added an entry to the change log under the Unreleased section of the file CHANGELOG.md. Entry should say what was changed and how that affects users (if applicable), and reference the issue being resolved (if applicable).
  • [ ] Resource documentation added/updated in README.md.
  • [ ] Resource parameter descriptions added/updated in README.md, schema.mof and comment-based help.
  • [ ] Comment-based help added/updated.
  • [ ] Localization strings added/updated in all localization files as appropriate.
  • [ ] Examples appropriately added/updated.
  • [ ] Unit tests added/updated. See DSC Community Testing Guidelines.
  • [ ] Integration tests added/updated (where possible). See DSC Community Testing Guidelines.
  • [x] New/changed code adheres to DSC Community Style Guidelines.

This change is Reviewable

raandree avatar Nov 25 '20 22:11 raandree

I have tested the new code with this DSC configuration:

configuration PackageTest {

    Import-DscResource -ModuleName xPSDesiredStateConfiguration
    Node localhost
    {
        foreach ($package in $packages)
        {
            xPackage $package.Name
            {
                Ensure       = 'Absent'
                Name         = $package.Name
                Path         = $package.Path
                ProductId    = ''
                Arguments    = $package.Arguments
                IgnoreReboot = $true
                #FileHash     = $package.FileHash #fixed in #703
            }
        }
    }
}

$packages = @(
    @{
        Name      = 'IrfanView 4.56 (64-bit)'
        Path      = 'C:\dsc\IrfanView 4.56 (64-bit).exe'
        Arguments = '/silent'
        FileHash  = '52A48ACF59027468C7F859B78C51196E42B47C9E65D17466FF1995F71A6CFF91'
    }
    @{
        Name     = 'Node.js'
        Path     = 'C:\dsc\Node.js.msi'
        FileHash = '8CC457D650137B468D40837CC939E8BE64313974375410FDC33CF58670ADA94B'
    }
    @{
        Name      = 'Notepad++ (32-bit x86)'
        Path      = 'C:\dsc\Notepad++ (32-bit x86).exe'
        Arguments = '/S'
        FileHash  = '4747B67F7E2CA69B3EE829FA22B01FC61F500FBA530FF928E31A3D5C62BE7FFA'
    }
    @{
        Name      = 'WinRAR 5.91 (64-bit)'
        Path      = 'C:\dsc\WinRAR 5.91 (64-bit).exe'
        Arguments = '/S'
        FileHash  = '892F7FDFDAF9FCEC6C035C8C65B280E18B7797620F4375699A2D4D41F60F794C'
    }
)

Remove-Item -Path C:\DSC\*.mof -Force
PackageTest -OutputPath C:\DSC
Start-DscConfiguration -Path C:\DSC -Wait -Verbose -Force

raandree avatar Nov 25 '20 22:11 raandree

Looks like the unit tests might need to be updated to fix this.

PlagueHO avatar Nov 26 '20 04:11 PlagueHO

Hi @raandree - it looks like the tests are failing on this one. Can you fix and I'll complete review?

PlagueHO avatar Dec 01 '20 06:12 PlagueHO

@raandree - can you resolve the conflicts on this one?

PlagueHO avatar Dec 06 '20 06:12 PlagueHO

Hi @raandree - what I'll do is mark this abandoned and might pick it up myself when I have time.

PlagueHO avatar May 29 '21 23:05 PlagueHO

Codecov Report

:exclamation: No coverage uploaded for pull request base (main@7b50109). Click here to learn what that means. The diff coverage is n/a.

:exclamation: Current head 8cd4a64 differs from pull request most recent head dae9bab. Consider uploading reports for the commit dae9bab to get more accurate results Impacted file tree graph

@@          Coverage Diff          @@
##             main   #705   +/-   ##
=====================================
  Coverage        ?    72%           
=====================================
  Files           ?     30           
  Lines           ?   4428           
  Branches        ?      0           
=====================================
  Hits            ?   3213           
  Misses          ?   1215           
  Partials        ?      0           

codecov[bot] avatar May 30 '21 13:05 codecov[bot]

@PlagueHO, I have done some changes.

raandree avatar May 30 '21 17:05 raandree