teamviewer.com link icon
or
Ask The Community

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

 

Comments

  • Wget is not a command in native windows. I would suggest using powershell to run a scripted update.
  • LeeBinder
    LeeBinder Posts: 15 ✭✭

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

  • LeeBinder
    LeeBinder Posts: 15 ✭✭

    What the ... this board's timeout settings does not allow me to edit my initial posting anymore - that is silly. I'll request to have them reopen it (and hopefully change that kiddy setting).

    @CodePrime8: I improved the Windows script. Due to lack of powershell wisdom still based on wget, but it should be user friendly enough. Bummer there are no static../wget/64/latest/wget.exe and ../wget/32/latest/wget.exe links..

    BTW, accdg. to this source, cUrl is included in Windows 10 since  build 17063. But for any Windows  below 10.17063 even cUrl would need to be installed, so I did not bother to adapt the Mac cUrl script for Windows.

    Spoiler
    ::::::::::::::::::::::::::::::::::::::::::::
    :: Elevate.cmd - Version 4
    :: Automatically check & get admin rights
    :: see "https://stackoverflow.com/a/12264592/1016343" for description
    ::::::::::::::::::::::::::::::::::::::::::::
    @echo off
    CLS
    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 Update and run TeamViewerQS
    echo ===========================
    echo.
    if exist %windir%\System32\wget.exe goto runWget
    echo This script requires Wget to update Teamviewer QS. It was not found in %windir%\System32.
    echo.
    echo Your default Internet Browser will now open. Please download the latest EXE version for your
    echo Windows - most likely 64bit, but if you're unsure 32bit - to your DOWNLOADS folder!
    echo.
    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 Next let's see if I can find wget.exe in your Downloads folder.
    rem have downloaded or copied to %windir%\System32.
    pause
    echo.
    if exist %userprofile%\Downloads\wget.exe copy %userprofile%\Downloads\wget.exe %windir%\System32
    goto :runWget
    :loop
    echo Sorry, Wget.exe not found in %userprofile%\Downloads. The %windir%\System32
    echo folder will open next so you can copy wget.exe there manually.
    echo.
    echo Therafter you NEED to return to this Window!
    echo.
    pause
    explorer %windir%\System32
    echo.
    echo Have you copied wget.exe to %windir%\System32?
    echo.
    pause
    if not exist %windir%\System32\wget.exe goto loop

    :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
  • LeeBinder
    LeeBinder Posts: 15 ✭✭

    Updated Scripts for macOS and Windows. Can't edit first posting, therefore here.

    And hey Teamviewer forum admins: still no spoiler/ (un-)hide function? Tzzss.. therefore attached.


  • LeeBinder
    LeeBinder Posts: 15 ✭✭

    Updated script for macOS. Can't edit first posting, therefore here.

    #!/bin/bash
    clear
    echo ====================================================
    echo "Latest TeamViewer QuickSupport Downloader & Launcher"
    echo ====================================================
    echo ""
    echo "Please wait a moment.."
    echo ""
    LocalFile=~/Downloads/TeamViewerQS.dmg
    RemoteFile=https://dl.teamviewer.com/download/TeamViewerQS.dmg
    #RemoteFile=https://dl.teamviewer.com/download/version_15x/TeamViewerQS.dmg
    #RemoteFile=https://dl.teamviewer.com/download/version_14x/TeamViewerQS.dmg
    #RemoteFile=https://dl.teamviewer.com/download/version_13x/TeamViewerQS.dmg
    #RemoteFile=https://dl.teamviewer.com/download/version_12x/TeamViewerQS.dmg
    #RemoteFile=https://dl.teamviewer.com/download/version_11x/TeamViewerQS.dmg
    #RemoteFile=http://dl.teamviewer.com/download/TeamViewerQS.dmg
    #RemoteFile=https://download.teamviewer.com/download/TeamViewerQS.dmg
    
    cd ~/Downloads
    #Local=$(wc -c < $LocalFile)
    if test -e $LocalFile; then Local=$(wc -c < $LocalFile | tr -d " \t" | cut -d ':' -f 2); fi
    #Remote=$(curl -LsI "$RemoteFile" | awk '/Content-Length/ {sub("\r",""); print $2}')
    Remote=$(curl -LsI $RemoteFile | grep [Cc]ontent-[Ll]ength: | awk '{sub("\r",""); print $2}')
    echo "TeamViewerQS.dmg local : $Local bytes"
    echo "TeamViewerQS.dmg remote: $Remote bytes"
    echo ""
    if [ "$Local" != "$Remote" ]; then
    #curl -Lo ~/Downloads/TeamViewerQS.dmg 'https://dl.teamviewer.com/download/TeamViewerQS.dmg'
    #curl -Lo ~/Downloads/TeamViewerQS.dmg 'https://download.teamviewer.com/download/TeamViewerQS.dmg'
    curl -Lo $LocalFile $RemoteFile
    else
    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;
    


Sign In or Register to comment.