1 $packageName = "Icinga 2";
3 $silentArgs = '/qr /norestart'
6 $packageGuid = Get-ChildItem HKLM:\SOFTWARE\Classes\Installer\Products |
7 Get-ItemProperty -Name 'ProductName' |
8 ? { $_.ProductName -like $packageName + "*"} |
9 Select -ExpandProperty PSChildName -First 1
11 $properties = Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\$packageGuid\InstallProperties
13 $file = $properties.LocalPackage
15 # Would like to use the following, but looks like there is a bug in this method when uninstalling MSI's
16 # Uninstall-ChocolateyPackage $packageName $fileType $silentArgs $file -validExitCodes $validExitCodes
19 $msiArgs = "/x $file $silentArgs";
20 Start-ChocolateyProcessAsAdmin "$msiArgs" 'msiexec' -validExitCodes $validExitCodes