chocolatey/packages/reolink-client/tools/chocolateyuninstall.ps1

35 lines
1.5 KiB
PowerShell
Raw Normal View History

2019-04-28 21:53:00 +02:00
#uninstall Reolink Client
#2011-2019 foo.li systeme + software
$packageName = 'reolink-client'
$packageSearch = 'Reolink Client*'
$r = Get-ItemProperty -Path @( 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*',
'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*',
'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*' ) `
-ErrorAction:SilentlyContinue `
| Where-Object { $_.DisplayName -like $packageSearch }
$r | ForEach-Object {
$exe = $_.UninstallString | Select-String -Pattern ".*exe`"?$"
$msi = $_.UninstallString | Select-String -Pattern "^MsiExec.*$"
if ($exe) {
$installerType = 'exe'
$silentArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-'
$validExitCodes = @(0)
Uninstall-ChocolateyPackage -PackageName "$packageName" `
-FileType "$installerType" `
-SilentArgs "$($silentArgs)" `
-File "$($_.UninstallString)" `
-ValidExitCodes $validExitCodes
}
if ($msi) {
$installerType = 'msi'
$silentArgs = '/quiet /qn /norestart'
$validExitCodes = @(0,3010)
Uninstall-ChocolateyPackage -PackageName "$packageName" `
-FileType "$installerType" `
-SilentArgs "$($_.PSChildName) $silentArgs" `
-ValidExitCodes $validExitCodes
}
}