Worklet: Uninstall TeamViewer on Windows

Hi all, we had a couple machines that had TeamViewer installed and needed to mass uninstall, thought I’d share the Worklet to uninstall this

Evaluation:

if (Test-Path -Path "C:\Program Files (x86)\TeamViewer") 
{
	Write-Output "TeamViewer not installed, skipping" 
	exit 0
} 
else 
{ 
	Write-Output "TeamViewer installed, we will uninstall" 
	Exit 1 
}

Remediation:

$AllApps = Get-ItemProperty "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
$TeamViewer = $AllApps | Where-Object {$_.DisplayName -Like "TeamViewer*"}
Write-Output "Uninstalling TeamViewer" 
Start-Process -FilePath ($TeamViewer.UninstallString) -ArgumentList "/S" -WindowStyle Hidden
1 Like