mirror of
https://github.com/YuzuZensai/Termix.git
synced 2026-09-13 10:49:03 +00:00
34 lines
1.0 KiB
PowerShell
34 lines
1.0 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|||
|
|
|
||
|
|
$packageName = 'termix-ssh'
|
||
|
|
$softwareName = 'Termix*'
|
||
|
|
$installerType = 'msi'
|
||
|
|
|
||
|
|
$silentArgs = '/qn /norestart'
|
||
|
|
$validExitCodes = @(0, 3010, 1605, 1614, 1641)
|
||
|
|
|
||
|
|
[array]$key = Get-UninstallRegistryKey -SoftwareName $softwareName
|
||
|
|
|
||
|
|
if ($key.Count -eq 1) {
|
||
|
|
$key | % {
|
||
|
|
$file = "$($_.UninstallString)"
|
||
|
|
|
||
|
|
if ($installerType -eq 'msi') {
|
||
|
|
$silentArgs = "$($_.PSChildName) $silentArgs"
|
||
|
|
$file = ''
|
||
|
|
}
|
||
|
|
|
||
|
|
Uninstall-ChocolateyPackage -PackageName $packageName `
|
||
|
|
-FileType $installerType `
|
||
|
|
-SilentArgs "$silentArgs" `
|
||
|
|
-ValidExitCodes $validExitCodes `
|
||
|
|
-File "$file"
|
||
|
|
}
|
||
|
|
} elseif ($key.Count -eq 0) {
|
||
|
|
Write-Warning "$packageName has already been uninstalled by other means."
|
||
|
|
} elseif ($key.Count -gt 1) {
|
||
|
|
Write-Warning "$($key.Count) matches found!"
|
||
|
|
Write-Warning "To prevent accidental data loss, no programs will be uninstalled."
|
||
|
|
$key | % {Write-Warning "- $($_.DisplayName)"}
|
||
|
|
}
|