Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Kill 3CX processes first
- Get-process | Where-Object {$\_.name -Like "*3CX*"} | stop-process
- # attempt #1 - via EXE uninstall method
- $3cxapps = Get-WMIObject - Class Win32\_product | where {$\_.name -
- like "*3CX*"} foreach ($app in $3cxapps) { $app.Uninstall() }
- # attempt #2 - via MSIEXEC
- $appName = "3CX Desktop App"
- $appInstalled = Get-WmiObject -Class Win32_Product | Where-Object {
- $_.Name -eq $appName }
- if ($appInstalled) {
- # Uninstall 3CX Desktop App
- $uninstallString = $appInstalled.UninstallString
- Start-Process msiexec.exe -ArgumentList "/x `"$uninstallString`"
- /qn" -Wait
- Write-Host "$appName has been uninstalled"
- } else {
- Write-Host "$appName is not installed"
- }
- # Check if 3CXPhone for Windows is installed
- $appName = "3CXPhone for Windows"
- $appInstalled = Get-WmiObject -Class Win32_Product | Where-Object {
- $_.Name -eq $appName }
- if ($appInstalled) {
- # Uninstall 3CXPhone for Windows
- $uninstallString = $appInstalled.UninstallString
- Start-Process msiexec.exe -ArgumentList "/x `"$uninstallString`"
- /qn" -Wait
- Write-Host "$appName has been uninstalled"
- } else {
- Write-Host "$appName is not installed"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement