Jtracy_ItPro

Zoom_x86-Uninstall_AllUsers.ps1

Sep 18th, 2020 (edited)
1,161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Universal MSI uninstaller for Zoom "All Users" SYSTEM version x86
  2. # these is no x64 version that I know of.
  3. # This doesn't cover per-user installs (the EXE).
  4. # - JT
  5.  
  6. $AppName = "Zoom"
  7.  
  8. # Sweep installed apps and pull the uninstall string.
  9. # This is meant to solve the problem of uninstalling auto-patched apps. with automation.
  10. # Any patches will change the GUID, so we want to run msiexec against that dynamically.
  11. # The config manager client can unisntall with this script, with no regard to the version that's actually installed.
  12. # This was tested on 4.x and 5.x MSIs.
  13.  
  14. ##################################################################
  15.  
  16. # Kill running instanced of this app. Lots of helper apps live in the background...
  17.  
  18. $AppPath = (${env:ProgramFiles(x86)} + "\Zoom\bin\*")
  19.  
  20. Get-Process | ? {$_.path -like $AppPath } | % {$_ | Stop-Process -Force -Verbose}
  21.  
  22. #######################################################
  23.  
  24. ## Look for specific architecture:
  25.  
  26. $UninstallRoot = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
  27.  
  28. #$UninstallRoot = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
  29.  
  30. # Find the first app which matches the name. Be careful to make it find the correct one, in case more than one app matches.
  31.  
  32. # ! ! ! no wildcards this time.
  33.  
  34. $AppInfo = Get-ChildItem -Path $UninstallRoot | Where-Object {$_.getValue("displayname") -eq ($AppName)} | Select-Object -First 1
  35.  
  36. $Version = $AppInfo.GetValue("DisplayVersion")
  37.  
  38. $LogFile = $env:TEMP + $AppName + "_" + $Version + "-Uninstall.log"
  39.  
  40. $AppGuid = $AppInfo.PSChildName
  41.  
  42.  
  43. # With all this information, run the uninstall command.
  44.  
  45. & MsiExec /x $AppGuid /q /norestart /log $LogFile | Wait-Process
  46.  
Add Comment
Please, Sign In to add comment