TeamViewer Host Assignment Fails in Jamf Pro on macOS with Error 206

Issue

When deployed from Jamf Pro TeamViewer_Assignment fails to associate using the -api-token parameter with the error 206 on macOS.

If the command is run from a terminal prompt it successfully assigns the computer.

Verifying package integrity...
Installing TeamViewer Host...
Successfully installed TeamViewer Host.
Running script TeamViewer Host Assignment...
Script exit code: 206
Script result:
Error running script: return code was 206.

Resolution

All of the TeamViewer processes must be fully running, before an assignment will be successful.

$ ps aux | grep -i TeamView | grep -v grep
user              6881   0.0  0.3  4432632  47748   ??  S     3:06pm   0:00.47 /Applications/TeamViewerHost.app/Contents/MacOS/TeamViewerHost -RunAsAgent YES
user              6879   0.0  0.1  4355920  15880   ??  S     3:06pm   0:00.63 /Applications/TeamViewerHost.app/Contents/MacOS/TeamViewer_Desktop -RunAsAgent YES -Module Host
root              6877   0.0  0.1  4352056  16400   ??  Ss    3:06pm   0:00.58 /Applications/TeamViewerHost.app/Contents/MacOS/TeamViewer_Service -Module Host


Use the following script in Jamf Pro to ensure all processes are fully running:
#!/bin/bash
APITOKEN=1234567-XXXXXXXXXXXXXXXXXXXX
GROUPID=g123456789
while true; do
	process=$(ps aux | grep TeamViewerHost | grep -v grep | wc -l)
        echo "Process: $process"
	if [ $process -gt 2 ]; then
		echo "Assigning..."
		sleep 15
                /Applications/TeamViewerHost.app/Contents/Helpers/TeamViewer_Assignment -api-token $APITOKEN -group-id $GROUPID -alias "$(hostname -s)" -grant-easy-access -reassign
		exit $?
	else
		echo "Waiting for TeamViewer to start..."
		sleep 15
	fi
done

References

Products

TeamViewer Host 15
Jamf Pro 10.x
Apple macOS 10.15

Created: 22nd May 2020
Updated: 22nd May 2020


© 2005-2020 Jamie Morrison