chocolateychoco

using package parameter overrides with choco uninstall


I need to uninstall a package that is not finding the correct software registry key. I want to override the package parameter for 'softwareName'. Here is the command I'm using:

choco uninstall -d newforma --override --params '/softwareName:Newforma*'

Here is the output of the debug:

Calling built-in PowerShell host with ['[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1' -packageScript 'C:\ProgramData\chocolatey\lib\newforma\tools\chocolateyuninstall.ps1' -installArguments '' -packageParameters '/softwareName:Newforma*' -overrideArgs'] Host version is 5.1.19041.1, PowerShell Version is '5.1.19041.5129' and CLR Version is '4.0.30319.42000'. ---------------------------Script Execution--------------------------- Running 'ChocolateyScriptRunner' for newforma v12.2.3.12933 with packageScript 'C:\ProgramData\chocolatey\lib\newforma\tools\chocolateyuninstall.ps1', packageFolder:'C:\ProgramData\chocolatey\lib\newforma', installArguments: '', packageParameters: '/softwareName:Newforma*', Running 'C:\ProgramData\chocolatey\lib\newforma\tools\chocolateyuninstall.ps1' Running Get-UninstallRegistryKey -softwareName 'newforma12.1*' Registry uninstall keys on system: 67 Error handling check: 'Get-ItemProperty' fails if a registry key is encoded incorrectly. WARNING: No registry key found based on 'newforma12.1*' Found 0 uninstall registry key(s) with SoftwareName:'newforma12.1*' WARNING: newforma has already been uninstalled by other means.

Thanks for you help in advance.


Solution

  • The --Override argument is only for use with the installargs parameter.

    It can't be used to override the softwareName being passed in to, e.g., Uninstall-ChocolateyPackage (or further down, Get-UninstallRegistryKey).

    You'll need to modify your uninstall script to say newforma* instead of newforma12.1*.