Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in xPackage resource: Uninstalling software does not work for .exe and .msi #704

Open
raandree opened this issue Nov 25, 2020 · 0 comments · May be fixed by #705
Open

Bug in xPackage resource: Uninstalling software does not work for .exe and .msi #704

raandree opened this issue Nov 25, 2020 · 0 comments · May be fixed by #705
Assignees
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.

Comments

@raandree
Copy link
Contributor

Details of the scenario you tried and the problem that is occurring

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.

Verbose logs showing the problem

VERBOSE: [INF001]: LCM:  [ Start  Set      ]  [[xPackage]WinRAR 5.91 (64-bit)]
VERBOSE: [INF001]:                            [[xPackage]WinRAR 5.91 (64-bit)] The path extension was '.exe'.
VERBOSE: [INF001]:                            [[xPackage]WinRAR 5.91 (64-bit)] Ensure is 'Absent'.
VERBOSE: [INF001]:                            [[xPackage]WinRAR 5.91 (64-bit)] product 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinRAR archiver' found.
VERBOSE: [INF001]:                            [[xPackage]WinRAR 5.91 (64-bit)] product as boolean is 'True'.
VERBOSE: [INF001]:                            [[xPackage]WinRAR 5.91 (64-bit)] The package 'WinRAR 5.91 (64-bit)' is installed.
VERBOSE: [INF001]:                            [[xPackage]WinRAR 5.91 (64-bit)] The path extension was '.exe'.
VERBOSE: [INF001]:                            [[xPackage]WinRAR 5.91 (64-bit)] Package configuration starting.
VERBOSE: [INF001]:                            [[xPackage]WinRAR 5.91 (64-bit)] Checking file 'C:\dsc\WinRAR 5.91 (64-bit).exe' for expected 'SHA256' hash value of '892F7FDFDAF9FCEC6C035C8C65B280E18B7797620F4375699A2D4D41F60F794C'.
VERBOSE: [INF001]:                            [[xPackage]WinRAR 5.91 (64-bit)] The binary is an EXE.
VERBOSE: [INF001]:                            [[xPackage]WinRAR 5.91 (64-bit)] Starting 'C:\Windows\system32\msiexec.exe' with '/x "WinRAR archiver" /quiet /norestart /S'.
VERBOSE: [INF001]:                            [[xPackage]WinRAR 5.91 (64-bit)] Starting process 'C:\Windows\system32\msiexec.exe' with arguments '/x "WinRAR archiver" /quiet /norestart /S'.

Suggested solution to the issue

Use the 'UninstallString' available in the registry instead of calling 'msiexec.exe'.

The DSC configuration that is used to reproduce the issue (as detailed as possible)

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
            }
        }
    }
}

$packages = @(
    @{
        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

The operating system the target node is running

OsName               : Microsoft Windows Server 2019 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 1809
WindowsBuildLabEx    : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Version and build of PowerShell the target node is running

Name                           Value                                                                                                                                                      
----                           -----                                                                                                                                                      
PSVersion                      5.1.17763.1432                                                                                                                                             
PSEdition                      Desktop                                                                                                                                                    
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                    
BuildVersion                   10.0.17763.1432                                                                                                                                            
CLRVersion                     4.0.30319.42000                                                                                                                                            
WSManStackVersion              3.0                                                                                                                                                        
PSRemotingProtocolVersion      2.3                                                                                                                                                        
SerializationVersion           1.1.0.1                                                                                                                                                    

Version of the DSC module that was used

9.1.0

raandree added a commit to raandree/xPSDesiredStateConfiguration that referenced this issue Nov 25, 2020
@PlagueHO PlagueHO added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels Nov 25, 2020
@raandree raandree linked a pull request Nov 25, 2020 that will close this issue
9 tasks
raandree added a commit to raandree/xPSDesiredStateConfiguration that referenced this issue Dec 6, 2020
PlagueHO added a commit to raandree/xPSDesiredStateConfiguration that referenced this issue Dec 17, 2020
@PlagueHO PlagueHO added help wanted The issue is up for grabs for anyone in the community. and removed in progress The issue is being actively worked on by someone. labels May 30, 2021
raandree added a commit to raandree/xPSDesiredStateConfiguration that referenced this issue May 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants