Batch File For Upgrade and Deployment of TeamViewer 13.2

Here's my working login script for anyone who is looking to upgrade from TeamViewer 13.1.3629. You will have to insert your UNC-PATH, YOUR-TOKEN, YOUR-ID for this to work correctly.

The script will check if the old version is installed then uninstall it, and install the new version. If upgrading from a different version you can go into the registry and find the key that shows version number and modify this script accordingly. Copy and paste the following into notepad and rename with .bat file extension:

set key=HKLM\SOFTWARE\WOW6432Node\TeamViewer
rem checking if old version exists
reg query %key% /f "13.1.3629"
if %errorlevel% EQU 0 goto :Uninstall
goto :Check2
rem uninstalling old version if exists
:Uninstall
net stop TeamViewer
"%programfiles(x86)%\TeamViewer\uninstall.exe" /S
msiexec /q /x {16755865-9D14-4B2F-BE19-03956AC3E6FF}
:Check2
set key=HKLM\SOFTWARE\WOW6432Node\TeamViewer
rem check if new version exists
reg query %key% /f "13.2.5287"
if %errorlevel% EQU 0 goto :End
rem installing new version if does not exist
msiexec.exe /i "\\UNC-PATH\TeamViewer_Host.msi" /qn CUSTOMCONFIGID=YOUR-ID IMPORTREGFILE=1 APITOKEN=YOUR-TOKEN ASSIGNMENTOPTIONS=--grant-easy-access
del /s /q /f "%PUBLIC%\Desktop\TeamViewer.lnk"
del /s /q /f "%PUBLIC%\Desktop\TeamViewer 13.lnk"
:End