Deploying the TeamViewer Application Using Jamf Pro

Jamf Pro Documentation 11.16.0

Solution
Application
Content Type
Technical Documentation
Utilities & Services
version
11.16.0
ft:locale
en-US
vrm_version
11.16.0

Jamf recommends the client Mac download the TeamViewer QuickSupport application during the remote support session. This requires no prior software installation. However, you can pre-install either the TeamViewer or TeamViewer Host application using the following procedure.

Note:

TeamViewer applications installed on end user Mac computers do not require licensing. The TeamViewer scripts avoid using Composer to repackage.

Requirements
  • Install "TeamViewer.pkg" or "Install TeamViewerHost.pkg" installer

  • Install "TeamViewer with Choices" script or "Install TeamViewer Host with Choices" script

  1. Download the TeamViewer or TeamViewer Host from the TeamViewer for macOS page.
  2. Open the DMG file.
  3. Right-click the "Install TeamViewer.app" or "Install TeamViewer Host.app" and choose Show Package Contents.
  4. Open Contents > Resources. Upload the "Install TeamViewer.pkg" or "Install TeamViewerHost.pkg" package to Jamf Pro > Settings > Computer management > Packages.
  5. Choose a desired script below and add the script to Jamf Pro > Settings > Computer management > Scripts.
    • Install TeamViewer with Choices

      #!/bin/zsh
      function logmessage()   {
          if [ $? = 0 ] ; then
              echo "$1"
          else
              echo "$2"
              echo "Aborting script"
              cleanup
              exit 1
          fi
      }
       
      function cleanup()  {
          /bin/rm -Rf "$tempDirectory"
          logmessage "Removed temporary items." "Failed removing temporary items."
          /bin/rm -f "/Library/Application Support/JAMF/Waiting Room/Install TeamViewer.pkg" && /bin/rm -Rf "/Library/Application Support/JAMF/Waiting Room/Install TeamViewer.pkg.cache.xml"
          logmessage "Removed TeamViewer package and supporting files from Jamf Waiting Room." "Failed Removing TeamViewer package and supporting files from Jamf Waiting Room."
      }
       
       
      choicesXML='<?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
      <plist version="1.0">
      <array>
          <dict>
              <key>attributeSetting</key>
              <integer>1</integer>
              <key>choiceAttribute</key>
              <string>selected</string>
              <key>choiceIdentifier</key>
              <string>com.teamviewer.teamviewerPriviledgedHelper</string>
          </dict>
          <dict>
              <key>attributeSetting</key>
              <integer>1</integer>
              <key>choiceAttribute</key>
              <string>selected</string>
              <key>choiceIdentifier</key>
              <string>com.teamviewer.teamviewerSilentInstaller</string>
          </dict>
      </array>
      </plist>'
       
       
      # create temporary working directory
      workDirectory=$( /usr/bin/basename $0 )
      tempDirectory=$( /usr/bin/mktemp -d "/private/tmp/$workDirectory.XXXXXX" )
      logmessage "Created working directory '$tempDirectory'." "Failed to create working directory '$tempDirectory'."
       
      # change directory to temporary working directory
      cd "$tempDirectory"
      logmessage "Changed directory to working directory '$tempDirectory'." "Failed to change directory to working directory '$tempDirectory'."
       
      echo "$choicesXML" > "$tempDirectory/choices.xml"
      logmessage "Created choices.xml file in '$tempDirectory'." "Created choices.xml file in '$tempDirectory'."
       
      /usr/sbin/installer -pkg "/Library/Application Support/JAMF/Waiting Room/Install TeamViewer.pkg" -applyChoiceChangesXML "$tempDirectory/choices.xml" -target /
      logmessage "Installed TeamViewer package with choices." "Failed to install TeamViewer package with choices."
       
      cleanup
       
      exit 0
    • Install TeamViewer Host with Choices

      #!/bin/zsh
      function logmessage()   {
          if [ $? = 0 ] ; then
              echo "$1"
          else
              echo "$2"
              echo "Aborting script"
              cleanup
              exit 1
          fi
      }
       
      function cleanup()  {
          /bin/rm -Rf "$tempDirectory"
          logmessage "Removed temporary items." "Failed removing temporary items."
          /bin/rm -f "/Library/Application Support/JAMF/Waiting Room/Install TeamViewerHost.pkg" && /bin/rm -Rf "/Library/Application Support/JAMF/Waiting Room/Install TeamViewerHost.pkg.cache.xml"
          logmessage "Removed TeamViewer Host package and supporting files from Jamf Waiting Room." "Failed Removing TeamViewer Host package and supporting files from Jamf Waiting Room."
      }
       
       
      choicesXML='<?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
      <plist version="1.0">
      <array>
          <dict>
              <key>attributeSetting</key>
              <integer>1</integer>
              <key>choiceAttribute</key>
              <string>selected</string>
              <key>choiceIdentifier</key>
              <string>com.teamviewer.teamviewerPriviledgedHelper</string>
          </dict>
          <dict>
              <key>attributeSetting</key>
              <integer>1</integer>
              <key>choiceAttribute</key>
              <string>selected</string>
              <key>choiceIdentifier</key>
              <string>com.teamviewer.teamviewerhostSilentInstaller</string>
          </dict>
      </array>
      </plist>'
       
       
      # create temporary working directory
      workDirectory=$( /usr/bin/basename $0 )
      tempDirectory=$( /usr/bin/mktemp -d "/private/tmp/$workDirectory.XXXXXX" )
      logmessage "Created working directory '$tempDirectory'." "Failed to create working directory '$tempDirectory'."
       
      # change directory to temporary working directory
      cd "$tempDirectory"
      logmessage "Changed directory to working directory '$tempDirectory'." "Failed to change directory to working directory '$tempDirectory'."
       
      echo "$choicesXML" > "$tempDirectory/choices.xml"
      logmessage "Created choices.xml file in '$tempDirectory'." "Created choices.xml file in '$tempDirectory'."
       
      /usr/sbin/installer -pkg "/Library/Application Support/JAMF/Waiting Room/Install TeamViewerHost.pkg" -applyChoiceChangesXML "$tempDirectory/choices.xml" -target /
      logmessage "Installed TeamViewerHost package with choices." "Failed to install TeamViewerHost package with choices."
       
      cleanup
       
      exit 0
      
  6. Create a policy to install TeamViewer using the DMG from step 4 and the installer script. Ensure the following:
    • TeamViewer package is set to Cache, not Install.

    • TeamViewer script priority is set to After.

    For instructions on creating a policy, see Policy Management.

The policy will run on computers in the scope the next time they check in with Jamf Pro and meet the criteria in the General payload.