Jtracy_ItPro

Jabber_x86-Uninstall.ps1

Sep 18th, 2020
854
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Uninstall Jabber
  2. # x86 MSI version
  3. # - JT
  4.  
  5.  
  6. $AppName = "Cisco Jabber"
  7.  
  8. #######################
  9.  
  10. Write-Output "Killing any running isntances of this app:"
  11.  
  12. Get-Process  | ? {$_.path -like "*Cisco Jabber*"} |  % {$_ | Stop-Process -Force -Verbose}
  13.  
  14. ###################################
  15.  
  16.  
  17. # Sweep installed apps and pull the uninstall string.
  18. # This is meant to solve the problem of uninstalling auto-patched apps. with automation.
  19. # Secunia will auto-apply new MSIs, which changes the string.
  20. # The config manager client can unisntall with this script, with no regard to the version that's actually installed.
  21.  
  22.  
  23. ## Look for both architectures.
  24.  
  25. $UninstallRoot = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
  26.  
  27. #$UninstallRoot = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
  28.  
  29. # Find the first app which matches the name. Be careful to make it find the corret one, in case more than one app matches.
  30.  
  31. # no wildcards, exact name match here
  32.  
  33. $AppInfo = Get-ChildItem -Path $UninstallRoot | Where-Object {$_.getValue("displayname") -eq $AppName} | Select-Object -First 1
  34.  
  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. $AppInfo
  46.  
  47. Write-Output "unisntalling"
  48.  
  49. & MsiExec /x $AppGuid /q /norestart /log $LogFile | Wait-Process
  50.  
RAW Paste Data