Posted by LeeBinder
Digon

Auto-Update TeamviewerQS (QuickSupport) - my scripts for Mac & Windows :)

Both scripts download to user folder Downloads!

macOS - tested in High Sierra 10.13.6
Filename:
Update & run TeamViewerQS.command
built date:
2019-08-10 - 1

Spoiler
#!/bin/bash
clear
echo ====================================
echo "Update & run TeamViewer Quicksupport"
echo ====================================
echo ""
echo "Please wait a moment.."
echo ""

LocalFile=~/Downloads/TeamViewerQS.dmg
RemoteFile=https://dl.teamviewer.com/download/TeamViewerQS.dmg

cd ~/Downloads
Local=$(wc -c < $LocalFile)
Remote=$(curl -sI $RemoteFile | awk '/Content-Length/ {sub("\r",""); print $2}')
if [ $Local != $Remote ]; then
#curl -o ~/Downloads/TeamViewerQS.dmg 'https://dl.teamviewer.com/download/TeamViewerQS.dmg'
curl -o $LocalFile $RemoteFile
else
echo ""
echo "$LocalFile exists and is same size as on server."
echo ""
fi

hdiutil attach TeamViewerQS.dmg

osascript -e 'tell application "Terminal" to set miniaturized of every window to true'
#osascript -e 'tell application "Terminal" to set visible of front window to false'
#osascript -e 'tell application "System Events" to click (first button of (every window of (application process "Terminal")) whose role description is "minimize button")'

/Volumes/TeamViewerQS/TeamViewerQS.app/Contents/MacOS/TeamViewerQS

eject () {
/usr/sbin/diskutil eject $(df | grep $1 | awk '{print $1}' | sed 's/\/dev\///')
}

diskutil unmountDisk force /Volumes/TeamViewerQS

#eject /Volumes/TeamViewerQS

osascript -e 'tell app "Terminal"' -e 'close (every window whose name contains ".command")' -e 'if number of windows = 0 then quit' -e 'end tell' & exit;

Windows - tested in Windows 10 1903 64bit
For now based on wget.exe whose download is facilitated by the script.
(planning to add download via cUrl for Windows 10 >= build 17063 which contains curl.exe)
Filename:
Update and run TeamViewerQS.bat
built date: 2019-08-10 - 1

Spoiler
@echo off
CLS
echo ===========================
echo Update and run TeamViewerQS
echo ===========================

if exist %windir%\System32\wget.exe goto runWget
::::::::::::::::::::::::::::::::::::::::::::
:: Elevate.cmd - Version 4
:: Automatically check & get admin rights
:: see "https://stackoverflow.com/a/12264592/1016343" for description
::::::::::::::::::::::::::::::::::::::::::::

 ECHO.
:init
 setlocal DisableDelayedExpansion
 set cmdInvoke=1
 set winSysFolder=System32
 set "batchPath=%~0"
 for %%k in (%0) do set batchName=%%~nk
 set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
 setlocal EnableDelayedExpansion

:checkPrivileges
  NET FILE 1>NUL 2>NUL
  if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )

:getPrivileges
  if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
  ECHO.
  ECHO **************************************
  ECHO Invoking UAC for Privilege Escalation
  ECHO **************************************

  ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
  ECHO args = "ELEV " >> "%vbsGetPrivileges%"
  ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
  ECHO args = args ^& strArg ^& " "  >> "%vbsGetPrivileges%"
  ECHO Next >> "%vbsGetPrivileges%"

  if '%cmdInvoke%'=='1' goto InvokeCmd 

  ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
  goto ExecElevation

:InvokeCmd
  ECHO args = "/c """ + "!batchPath!" + """ " + args >> "%vbsGetPrivileges%"
  ECHO UAC.ShellExecute "%SystemRoot%\%winSysFolder%\cmd.exe", args, "", "runas", 1 >> "%vbsGetPrivileges%"

:ExecElevation
 "%SystemRoot%\%winSysFolder%\WScript.exe" "%vbsGetPrivileges%" %*
 exit /B

:gotPrivileges
 setlocal & cd /d %~dp0
 if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul  &  shift /1)

 ::::::::::::::::::::::::::::
 ::START
 ::::::::::::::::::::::::::::
REM Everything below runs elevated ("as admin")

echo This script requires Wget to update Teamviewer QS. It was not found in %windir%\System32.
echo.
echo Your default Internet Browser will open next. Please download the latest EXE
echo version for your Windows - most likely 64bit, but if you're unsure 32bit -
echo to your DOWNLOADS folder. This script will then proceed automatically.
rem echo Once you've done that, you NEED to return to this Window (for example by minimizing or closing your Browser)!
echo.
pause

rem start iexplore "https://eternallybored.org/misc/wget"
rem explorer "https://eternallybored.org/misc/wget"
rem start /max https://eternallybored.org/misc/wget
rundll32 url.dll,FileProtocolHandler https://eternallybored.org/misc/wget
echo.
echo Waiting now patiently for wget.exe to appear in your Downloads folder...
rem pause
:waitForWgetLoop
timeout 2 /NOBREAK
if not exist %userprofile%\Downloads\wget.exe goto waitForWgetLoop
move %userprofile%\Downloads\wget.exe %windir%\System32\

:runWget
rem cd /d %~dp0
rem cd /D %systemdrive%%homepath%\Downloads
rem cd /D %HOMEDRIVE%%homepath%\Downloads
cd /D %userprofile%\Downloads

rem wget --spider -S http://download.teamviewer.com/download/TeamViewerQS.exe
rem wget --no-check-certificate -O TeamViewerQS.exe http://download.teamviewer.com/download/TeamViewerQS.exe
rem wget -N http://download.teamviewer.com/download/TeamViewerQS.exe

wget -N --no-check-certificate http://download.teamviewer.com/download/TeamViewerQS.exe

start "" TeamViewerQS.exe

 

2 Replies
2 Replies
Posted by CodePrime8
Photon

Re: Auto-Update TeamviewerQS (QuickSupport) - my scripts for Mac & Windows :)

Wget is not a command in native windows. I would suggest using powershell to run a scripted update.
Posted by LeeBinder
Digon

Re: Auto-Update TeamviewerQS (QuickSupport) - my scripts for Mac & Windows :)

Yes, thanks. I don't know Powerscript. I added a link regarding Wget in my posting above.