Jtracy_ItPro

BlueJeans_x64-Uninstall_AllUsers.ps1

Sep 18th, 2020 (edited)
1,031
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Uninstall BlueJeans
  2. # x64 MSI - SYSTEM install
  3. # - JT
  4.  
  5. #####################################
  6.  
  7. $AppName = "BlueJeans (All User)"
  8.  
  9. # Sweep installed apps and pull the uninstall string.
  10. # This is meant to solve the problem of uninstalling auto-patched apps. with automation.
  11. # Secunia will auto-apply new MSIs, which changes the string.
  12. # The config manager client can unisntall with this script, with no regard to the version that's actually installed.
  13.  
  14.  
  15. ##################################################################
  16.  
  17. Write-Output "* Killing any running instances of this app:"
  18.  
  19. $ProcessPath = $env:ProgramFiles + "\BlueJeans\"
  20.  
  21. Get-Process | ? {$_.path -like ($ProcessPath + "*")} | % {$_ | Stop-Process -Force -Verbose}
  22.  
  23.  
  24. #######################################################
  25.  
  26. ## Look for both architectures.
  27.  
  28. #$UninstallRoot = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
  29.  
  30. $UninstallRoot = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
  31.  
  32. # Find the first app which matches the name. Be careful to make it find the corret one, in case more than one app matches.
  33.  
  34. # ! ! ! no wildcards this time.
  35.  
  36. $AppInfo = Get-ChildItem -Path $UninstallRoot | Where-Object {$_.getValue("displayname") -eq ($AppName)} | Select-Object -First 1
  37.  
  38. $Version = $AppInfo.GetValue("DisplayVersion")
  39.  
  40. $LogFile = $env:TEMP + "\" + $AppName + "_" + $Version + "-Uninstall.log"
  41.  
  42. $AppGuid = $AppInfo.PSChildName
  43.  
  44.  
  45. # With all this information, run the uninstall command.
  46.  
  47. & MsiExec /x $AppGuid /q /norestart /log $LogFile | Wait-Process
  48.  
RAW Paste Data