Skip to content

Commit

Permalink
(GH-460) Amended Template
Browse files Browse the repository at this point in the history
Using 'choco new' to produce ChocolateyUninstall.ps1 for your package would result in the uninstall block never being executed as the $key variable type was wrong. Updated the script template to force the $key variable to always be an array and therefore have a Count method that can be evaluated and the uninstall block executed.

Closes #460
  • Loading branch information
pauby authored and ferventcoder committed Mar 29, 2016
1 parent 0971aeb commit ad27a72
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class ChocolateyUninstallTemplate
$machine_key = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
$machine_key6432 = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
$key = Get-ItemProperty -Path @($machine_key6432,$machine_key, $local_key) `
[array]$key = Get-ItemProperty -Path @($machine_key6432,$machine_key, $local_key) `
-ErrorAction SilentlyContinue `
| ? { $_.DisplayName -like ""$softwareName"" }
Expand Down

0 comments on commit ad27a72

Please sign in to comment.