Deploying TeamViewer unattended host

So I’ve been playing with deploying TeamViewer 13 unattended host for several hours today and have reached the conclusion that the deployment documentation is just grossly inadequate. Here’s what I’ve learned after looking at several forum posts:

  1. Don’t try to deploy your customized TeamViewer unattended host MSI application via the GPO software installation package method in Active Directory. Deploy GPO using a batch script or powershell instead and save yourself the aggravation of troubleshooting why some workstations won’t install the package.
    1. I tried the GPO software installation package method first because it’s one of the recommended ways to deploy the TeamViewer MSI via the official deployment documentation on P7. But after finding that most of my deployments failed with %%2 and %%1274 even after adding a 30 second delay to Computer Configuration > Policies > Administrative Templates > System > Group Policy > Startup policy processing wait time, I decided i had wasted enough time troubleshooting this method and found the script method to work much better.
    2. What finally worked consistently for me was this simple batch script (where XXXXXXX is your deployment ID):

      start /wait msiexec.exe /i \\SERVER\SHARE\TeamViewer_Host-idcXXXXXXX.msi /qn

  2. If systems already have TeamViewer installed (either deployed or manually installed), you won’t be able to use the TeamViewer assignment tool to assign newly deployed unattended host installs (where the newest version was just installed over an existing version) to a new or different TeamViewer account. Running the Teamviewer_Assignment.exe on an existing install that was upgraded via deployment will yield the following error:

    Error: Assignment failed with: Reading datafile “C:\Program Files (x86)\TeamViewer\AssignmentData.json” failed with: File not found

    If you’re like me, where the customer used a new TeamViewer ID to sign up for the upgraded version, you’ll need to completely uninstall TeamViewer host on all workstations and then re-install. Here’s how:

    1. Run a GPO with a script to completely remove TeamViewer first. Here is an example of a script for removing x64 versions of older TeamViewer versions:
    2. @echo offREM Check for running TeamViewer processes

      tasklist /FI “IMAGENAME eq TeamViewer.exe” 2>NUL | find /I /N “TeamViewer.exe”>NUL
      if “%ERRORLEVEL%”==”0” (GOTO :CHECK) ELSE (GOTO :END)

      REM Check if TeamViewer 13 is already installed (crude test that may not work for everyone).

      :CHECK
      Set “VER=C:\users\public\desktop\TeamViewer 13 Host.lnk”
      IF EXIST “%VER%” (GOTO :END) ELSE (GOTO :UNINSTALL)

      REM Uninstall TeamViewer and remove registry entry (needed if re-assigning to a different account)

      :UNINSTALL
      taskkill /f /im TeamViewer.exe
      TIMEOUT 2
      start “C:\Program Files (x86)\TeamViewer\uninstall.exe” /S
      reg delete “HKLM\Software\Wow6432Node\TeamViewer” /f
      TIMEOUT 10
      exit

      :END
      exit

    3. After complete removal, re-install TeamViewer.
    4. Now run the TeamViewer Assignment tool and it should succeed.
    5. @echo off
      TIMEOUT 60
      start /wait msiexec.exe /i \\SERVER\SHARE\Teamviewer_Host-XXXXXXXX.msi /qn
      TIMEOUT 30
      start /wait \\SERVER\SHARE\TeamViewer_Assignment.exe -apitoken XXXXXXX-XXXXXXXXXXX -datafile “C:\Program Files (x86)\TeamViewer\AssignmentData.json” -allowEasyAccess=true -devicealias “${COMPUTERNAME}”
      exit
  3. Finally, if you want to push a uniform personal password to your deployed unattended host installs (generally not recommended, but sometimes required), you’ll have to do it by exporting a .reg file, naming it TeamViewer_Settings.reg (the name matters) and storing it in the same share as the TeamViewer MSI deployment installation file. Here’s how:
    1. On a workstation with the same version of TeamViewer installed, select Extras->Options->Advanced->Show Advanced Options->Export options to a *.reg file.
    2. Enter TeamViewer_Settings.reg as the filename and click Save.
    3. Check the Export personal password option and enter and confirm a desired personal password to set for each unattended host install. Then click Export.
    4. Store the resultant TeamViewer_Settings.reg file on a network share where your MSI file exists. When TeamViewer is deployed, the exported password will automatically be set as the personal password on all deployed systems.
      exit

That’s it folks.

Comments

One response to “Deploying TeamViewer unattended host”

  1. Timothy Bryant Avatar

    I’m going to go ahead and lay out what I am trying to do so that the Teamviewer powers that be might see my plea and give us the ability to install through Intune, especially since there are already hooks into Intune for Teamviewer.

    I want to push the Host MSI to all of my Intune joined Windows PCs. We are a school district, so these Lenovo N24 laptops are used by multiple students. I need the Host MSI so that we can easily get in and repair issues that teachers report with the laptop. I added the MSI, but I’m wondering how successful it will be with those extra settings. I wish they could be wrapped into the MSI.
    So this is the error I get when I try to assign the MSI to a device; A user can’t be targeted with a device context install (0X87D10780)

    I set up a device group, dropped this laptop into it, and assigned that MSI. There is no user be targeted, just the device.