You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.1 KiB
30 lines
1.1 KiB
$ErrorActionPreference = 'Stop'; |
|
|
|
$packageName = 'zerotier-one' |
|
$softwareName = 'ZeroTier One*' |
|
$installerType = 'MSI' |
|
|
|
$silentArgs = '/qn /norestart' |
|
$validExitCodes = @(0, 3010, 1605, 1614, 1641) |
|
$uninstalled = $false |
|
|
|
[array]$key = Get-UninstallRegistryKey -SoftwareName $softwareName |
|
|
|
if ($key.Count -eq 1) { |
|
$key | % { |
|
$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." |
|
Write-Warning "Please alert package maintainer the following keys were matched:" |
|
$key | % {Write-Warning "- $_.DisplayName"} |
|
}
|
|
|