Procedure to uninstall TeamViewer completely

Hi ,

Please refer below procedure to uninstall team viewer in windows machines,


import os
vbs='''
Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run "taskkill /im TeamViewer.exe", , True
objShell.Run("""%ProgramFiles%\TeamViewer\uninstall.exe"" /S")
Set objShell = Nothing
'''

path=os.environ['TEMP']
drive=os.environ['SYSTEMDRIVE']
filepath=path+'\\removetv.vbs'
fob=open(filepath,'w+')
fob.write(vbs)
fob.close()

if 'PROGRAMW6432' in  os.environ.keys():
    out=os.popen(drive+'\\Windows\\SysWOW64\\cscript.exe   '+filepath).read()
    print (out)
else:
    out=os.popen(drive+'\\Windows\\system32\\cscript.exe   '+filepath).read()
    print (out)

try:
    os.remove(filepath)
except:
    pass

print ('Team viewer uninstalled successfully')

20170223-Uninstall-team-viewer-completely.json (1.24 KB)

This script does not work, but I have converted our CMD script to VBS which looks like this and seems to do the trick capturing all version from 1 to 20 (I know 20 is not out yet but future proofing!)

import os
vbs='''
Dim WshShell
Dim WshFso
Dim processor_architecture
Dim programpath
Dim tvpath
Dim tvprogram
Dim tvversions
Dim exists

Set WshShell =  CreateObject("WScript.Shell")
Set WshFso = CreateObject("Scripting.FileSystemObject")
tvprogram = "uninstall.exe /S"


''Determine OS Architecture
processor_architecture= WshShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%")
If processor_architecture = "x86" Then
    '32bit system found
    programpath= WshShell.ExpandEnvironmentStrings("%PROGRAMFILES%")
Else
    '64bit system found
    programpath= WshShell.ExpandEnvironmentStrings("%PROGRAMFILES(x86)%")
End If


'Uninstall TeamViewer
WshShell.Run "taskkill /im TeamViewer.exe", , True
For tvversions = 1 To 20
    tvpath=programpath & "\TeamViewer\Version" & tvversions & "\"
    exists = WshFso.FolderExists(tvpath)
    If (exists) Then
        'WshShell.Run("""C:\Program Files (x86)\TeamViewer\Version" & tvversions & "\uninstall.exe"" /S")
        WshShell.Run(""tvpath & "uninstall.exe"" /S")
        'WshShell.Run(tvpath & tvprogram)
        'msgbox(tvpath & tvprogram)
    End If
Next
'''

path=os.environ['TEMP']
drive=os.environ['SYSTEMDRIVE']
filepath=path+'\\removetv.vbs'
fob=open(filepath,'w+')
fob.write(vbs)
fob.close()

if 'PROGRAMW6432' in  os.environ.keys():
    out=os.popen(drive+'\\Windows\\SysWOW64\\cscript.exe   '+filepath).read()
    print (out)
else:
    out=os.popen(drive+'\\Windows\\system32\\cscript.exe   '+filepath).read()
    print (out)

try:
    os.remove(filepath)
except:
    pass

print ('Team viewer uninstalled successfully')

Hi @StrobeTech

Great work, Highly appreciated!

Thank you for sharing your script to our community.