Jtracy_ItPro

RingCentral_x64-Uninstall.ps1

Sep 18th, 2020
1,264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Uninstall RingCentral
  2. # x64 MSI
  3.  
  4. ########################
  5.  
  6. # The unisntall info lives in "products" part of registry. That's not typical. I can't get the GUID the usual way.
  7.  
  8. $AppName = "RingCentral"
  9.  
  10. # Sweep installed apps and pull the uninstall string.
  11. # This is meant to solve the problem of uninstalling auto-patched apps. with automation.
  12. # Secunia will auto-apply new MSIs, which changes the string.
  13. # The config manager client can unisntall with this script, with no regard to the version that's actually installed.
  14.  
  15.  
  16. ##################################################################
  17.  
  18. # Kill processes.
  19.  
  20. $ProcessName = "RingCentral"
  21.  
  22. Get-Process | ? {$_.name -eq $ProcessName} | % {$_ | Stop-Process -Force -Verbose}
  23.  
  24. #######################################################
  25.  
  26. # ! ! ! no wildcards this time.
  27.  
  28. $AppInfo = gwmi win32reg_addremoveprograms | ?{$_.displayname -eq  $AppName}
  29.  
  30.  
  31. # !!!! No detailed info here. No version etc. Just name and guid.
  32.  
  33. $Version = $AppInfo.Version
  34.  
  35. $LogFile = $env:TEMP + "\" + $AppName + "_" + $Version + "-Uninstall.log"
  36.  
  37. $AppGuid = $AppInfo.ProdId
  38.  
  39. # With all this information, run the uninstall command.
  40.  
  41. & MsiExec /x $AppGuid /q /norestart /log $LogFile | Wait-Process
  42.  
Add Comment
Please, Sign In to add comment