Search

Unattended installation of TeamViewer

On this page solutions are presented to install TeamViewer unattended either by repackaging it into MSI format or by installing it unattended through a logon script. The problem for Group Policy or management system deployment is that the installation of TeamViewer is not in .msi format, which is a requirement. This page will go through how to solve these problems.

The MSI edition of Automation Studio is designed specifically for admins that only want to use the MSI features for repackaging of TeamViewer and other products. A similar article for MalwareBytes is available here and here for one on Avast.

Download FastTrack Automation Studio

Step 1 of 2: Extract the installer files

The first step is to extract the real installation files. The setup program is just a container for the these. Go through these steps to get the real installation files:
  • Go to www.teamviewer.com and click the download link.
  • Run the setup program, but do not click "next", when the installation starts.
  • Open Explorer and go to %temp%\TeamViewer, as shown below.


  • There is most likely a subfolder named the version of TeamViewer, for example "Version9". Double-click this folder to change directory.
  • Copy TeamViewer_.exe to a new working directory and close the installer.
The installation can now be executed passing /S (parameters are case sensitive) to the TeamViewer_.exe file. We can now either execute the installation unattended or repackage it into MSI format for mass deployment through Group Policies or a management system like SCCM. We will go through both options below.

Note that a /MSI switch also exists, which will nicely avoid the start of TeamViewer after successful installation. This means that you can just use the /MSI switch and build an MSI file using the EXE-to-MSI wizard. However, if you do not have the licensed version, this switch will install the trial version instead of the free one.

Step 2 of 2 - option 1: Deployment through Group Policies or a management system

To deploy TeamViewer with Group Policies, we need to repackage the installation into a Windows Installer .msi file. FastTrack Automation Studio can package a script and installation files into an .msi file, as explained here. The installation script must basically just run the installation unattended and kill the application. All we need is to start the installation using the /S switch and kill TeamViewer after installation. A simple installation script to do so, looks like the one below. The user will not see the application start, because the KillProcess command will kill the application before it is visible.

Run TeamViewer_.Exe,/S

KillProcess TeamViewer.Exe

However, we should always include an uninstallation in an MSI script, so we need to expand the script a bit. Go to Scripting Mode, if you are in App Factory mode. Create a new script and either select "TeamViewer MSI" in the "New Script" window or use the snippet below. Save the script in the same folder as your TeamViewer_.exe file.

If MSIInstallContext Then

  Run TeamViewer_.Exe,/S

  KillProcess TeamViewer.Exe

Else

  Run "[ProgramUninstaller TeamViewer]" /S

End If

The MSIInstallContext condition detects if the script is currently installing or uninstalling and the ProgramUninstaller function asks the system for the uninstallation string for TeamViewer, which will uninstall silently, when the /S parameter is passed to the uninstaller. If an older version may be installed, we can make sure that TeamViewer is not running during the upgrade or installation. An expanded version could look like this:

If MSIInstallContext Then

  CloseApplication TeamViewer.exe,TeamViewer

  Run TeamViewer_.Exe,/S

  KillProcess TeamViewer.Exe

Else

  Run "[ProgramUninstaller TeamViewer]" /S

End If

Next click the MSI menu item or press F12. Make sure that you have TeamViewer_.exe located in the same folder as the script file.

Creating MSI file from project

The MSI generation wizard will open, as shown below. Make sure that you check "Include additional files from my project folder inside the MSI file". When you get to the page to select additional files inside the MSI file, make sure to check TeamViewer_.exe to embed the the setup file inside the MSI file.

Malwarebytes MSI installation properties

The new .msi file that we have created for TeamViewer, can now be assigned as a software installation through Group Policies.

Install software through GPO

Only want EXE-to-MSI and MSI installation package building?


FastTrack Automation Studio MSI Edition Automation Studio MSI Edition

- Unlimited number of admins
- Unlimited number of users
- Unlimited number of clients

$1599.00   
Buy now

Step 2 of 2 - option 2: Installation through a logon script

Instead of deploying an MSI file, you can choose to execute the installation from a logon script. To make the installation unattended through a logon script, we need to:
  • Obtain administrative permissions to install the application.
  • Optionally make sure the installation only happens on computers in a certain Active Directory group.
  • Execute TeamViewer_.exe passing /S as an administrator.
  • TeamViewer starts after successful installation, so we also need to kill it to avoid end-user confusion.
If you do not have UAC enabled, you can execute the installation as part of your logon script and use the internal FastTrack installer logic to keep track of installations, as explained here. If you do have UAC enabled, you can do this in a similar way with a startup script, see the UAC page for more information.

We are assuming here that you have put TeamViewer_.exe in a folder named "TeamViewer" in the root of a share called \\AcmeServer\Installers$. You need to replace this and the installation user with information that is suitable on your network. As part of the logon script, we can then insert this:

If ComputerIsMemberOf TeamViewerComputers Then

  If Not InstalledBuild TeamViewer,1 Then

    RunScript \\AcmeServer\Installers$\TeamViewer\Install.fsh,AcmeDom\AcmeInstall,DCRWXKMsTt0QEo/xBdqOsw==

  End If

End If

If you want TeamViewer installed on all computers, you can remove the outer condition. But in the above example, TeamViewer is only installed on computers in an Active Directory group called "TeamViewerComputers". The user "AcmeInstall" must be replaced with an administrative user in your domain. The password must be encrypted with the "Encrypt Password" tool in the script editor, which can be started by pressing F8.

We now need to create the installation script on the location "\\AcmeServer\Installers$\TeamViewer\Install.fsh". In the same folder, you also need to have TeamViewer_.exe. The script requires these three lines:

Run TeamViewer_.Exe,/S

KillProcess TeamViewer.Exe

RegisterInstallation TeamViewer,7.0,1

The installation is executed unattended and when the installation is complete, the program starts and we must terminate it. The user will not see this, as this all happen within a few milliseconds. Finally the "RegisterInstallation" command ensures that the installation will not run again, which is explained here.
Outlook Signature Generation

Outlook Signatures

Visually build mass-deployable MSI format Outlook signatures. More
Zero Touch Thin PC

Zero Touch Thin PC

Turn Windows into a thin client and back with zero touch. More
Graphical Logon Scripts EXE to MSI

Graphical Logon Scripts

Build graphical logon scripts with your logo for advanced desktop preparation. More

EXE to MSI

Convert TeamViewer, Malwarebytes, Avast and others into MSI format. More
FastTrack Inventory

Inventory in the Cloud

Save on unnecessary licenses. Set up a cloud-based inventory. More
Laptop Backups

Laptop Backups

Utilize the world's fastest synchronizer for replication and laptop backups. More

Desktop Authority user? Check this page to find out how to cut your cost by 75%

Download FastTrack Automation Studio Buy FastTrack Automation Studio
Kawasaki Goodyear Maersk Informa Department of Commerce Disney GLS Telenor AJG NOAA