Jtracy_ItPro

WebEx_Teams_x64-Uninstall_PerUser.ps1

Sep 18th, 2020
687
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # uninstall Webex Teams x64 MSI
  2. # Per-user install (default)
  3.  
  4. # I need to use a different approach for per-user.
  5. # WMI is slow, but registry doesn't give me all the info I need
  6. # to universally track down the product GUID.
  7.  
  8. ###################
  9.  
  10. $Transcript = $env:TEMP + "\WebEx_Teams-Unisntall_Transcript.log"
  11.  
  12. Start-Transcript -Path $Transcript
  13.  
  14. #######################################
  15.  
  16. $AppName = "Webex Teams"
  17.  
  18. ##################################################################
  19.  
  20. # Kill running instances of this app.
  21.  
  22. Write-Output "* Killing running processes..."
  23.  
  24. Get-Process | ? {$_.path -like "*Cisco Spark*"} | % {$_ | Stop-Process -Force -Verbose}
  25. Get-Process | ? {$_.path -like "*CiscoCollab*"} | % {$_ | Stop-Process -Force -Verbose}
  26.  
  27.  
  28. ################
  29. # Exact match this time
  30.  
  31. Write-Output "* Finding the app..."
  32.  
  33. $AppInfo = gwmi win32reg_addremoveprograms | ?{$_.displayname -eq  $AppName}
  34.  
  35. #####################
  36.  
  37.  
  38. $Version = $AppInfo.Version
  39. $LogFile = $env:TEMP + "\" + $AppName + "_" + $Version  + "-Uninstall.log"
  40. $AppGuid = $AppInfo.ProdID
  41.  
  42. ##########
  43.  
  44. $AppInfo  | select *
  45.  
  46. Write-Output "* Uninstalling..."
  47.  
  48. & MsiExec /x $AppGuid /q /norestart /log $LogFile | Wait-Process
  49.  
  50. #########################
  51.  
  52. Stop-Transcript
RAW Paste Data