Advertisement
Cogger

Uninstall-Teamviewer.ps1

Jan 12th, 2023
934
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $Vendor  = "TeamViewer"
  2. $Prodcut = "TeamViewer"
  3. $ProductGUID = (get-wmiobject Win32_Product | Sort-Object -Property Name |  Where-Object Vendor -match $Vendor).IdentifyingNumber
  4. (get-process | ? { $_.mainwindowtitle -ne "" -and $_.processname -eq "$Prodcut" } )| stop-process -Force
  5. $arrCheck = [bool]($ProductGUID -is [array]) ;
  6. if( ($arrCheck -eq $False) -and ($ProductGUID -ne $null) ){ Start-Process "C:\Windows\System32\msiexec.exe" -ArgumentList "/x $ProGUID /qn" }
  7. if( ($arrCheck -eq $True)  -and ($ProductGUID -ne $null) ){ foreach ($ProGUID in $ProductGUID) { Start-Process "C:\Windows\System32\msiexec.exe" -ArgumentList "/x $ProGUID /qn" }
  8. if( ($arrCheck -eq $False) -and ($ProductGUID -eq $null) ){ Write-Host("No Product with name available") -Fore Yellow }
  9. $ProductGUID = $null ; $ProGUID = $null }
  10.  
  11.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement