deploy – TeamViewer host

echo off
setlocal ENABLEDELAYEDEXPANSION
if exist %ProgramFiles(x86)%\TeamViewer\TeamViewer.exe (GOTO IS_INSTALLED) else (GOTO INSTALL)
GOTO INSTALL
:IS_INSTALLED
echo is installed
eventcreate /L APPLICATION /T INFORMATION /SO %~n0%~x0 /ID 208 /D "%~0 -- Teamviewer is already installed"
REM assign Teamviewer to ABC
"C:\Program Files (x86)\TeamViewer\Teamviewer.exe" assign --api-token=123456-xyzxyzxyz --grant-easy-access
GOTO DONE
:INSTALL
echo installing software
eventcreate /L APPLICATION /T INFORMATION /SO %~n0%~x0 /ID 404 /D "%~0 -- Teamviwer is not installed -- installing now…"
if not exist c:\TEMP mkdir C:\TEMP\
if not exist c:\temp\TeamViewer_Host.msi (curl -C - -o c:\temp\TeamViewer_Host.msi https://example.com/TeamViewer_Host.msi)
start /wait msiexec /i C:\TEMP\TeamViewer_Host.msi /qn CUSTOMCONFIGID=abcdef
ping -n 5 127.0.0.1>nul
"C:\Program Files (x86)\TeamViewer\Teamviewer.exe" assign --api-token=123456-xyzxyzxyzxyz --grant-easy-access
GOTO DONE
:DONE
exit

Leave a Reply

Your email address will not be published. Required fields are marked *