Advertisement
Guest User

Untitled

a guest
Mar 29th, 2023
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. # Kill 3CX processes first
  2. Get-process | Where-Object {$\_.name -Like "*3CX*"} | stop-process
  3.  
  4. # attempt #1 - via EXE uninstall method
  5. $3cxapps = Get-WMIObject - Class Win32\_product | where {$\_.name -
  6. like "*3CX*"} foreach ($app in $3cxapps) { $app.Uninstall() }
  7.  
  8. # attempt #2 - via MSIEXEC
  9. $appName = "3CX Desktop App"
  10. $appInstalled = Get-WmiObject -Class Win32_Product | Where-Object {
  11. $_.Name -eq $appName }
  12.  
  13. if ($appInstalled) {
  14. # Uninstall 3CX Desktop App
  15. $uninstallString = $appInstalled.UninstallString
  16. Start-Process msiexec.exe -ArgumentList "/x `"$uninstallString`"
  17. /qn" -Wait
  18. Write-Host "$appName has been uninstalled"
  19. } else {
  20. Write-Host "$appName is not installed"
  21. }
  22.  
  23. # Check if 3CXPhone for Windows is installed
  24. $appName = "3CXPhone for Windows"
  25. $appInstalled = Get-WmiObject -Class Win32_Product | Where-Object {
  26. $_.Name -eq $appName }
  27.  
  28. if ($appInstalled) {
  29. # Uninstall 3CXPhone for Windows
  30. $uninstallString = $appInstalled.UninstallString
  31. Start-Process msiexec.exe -ArgumentList "/x `"$uninstallString`"
  32. /qn" -Wait
  33. Write-Host "$appName has been uninstalled"
  34. } else {
  35. Write-Host "$appName is not installed"
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement