To assign a Windows device via command line, please follow the instructions below:
echo %errorlevel%
into the command line to verify if the process was successful:
TeamViewer.exe assignment --id paste_your_assignment_id_here --offline
Example:
TeamViewer.exe assignment --id 0001CoBBChARKJtw_okR6o_fJ7AisynpEigIACAfAgAJAOjwtNCVK_JiM5lVdgdfguSk-gQ= --offline
This is an additional option you can add to your command line:
--device-alias=[<name>]
Alias for the new device in the Device list. No alias will be applied if the device is already in the contact list. The property can take the following values:
Example:
"C:\Program Files\TeamViewer\TeamViewer.exe" assignment --id 123 --device-alias=%COMPUTERNAME%-%USERNAME%
Hint: If you want to use spaces, you have to put everything in "..." like in the following example:
"C:\Program Files\TeamViewer\TeamViewer.exe" assignment --id 123 --device-alias=“%COMPUTERNAME% Test %USERNAME%“
To handle devices that are offline during the assignment, it stores the assignment in the registry as an encrypted property and executes it automatically when the device comes online. This property is deleted once the device is successfully assigned.
Prerequisites:
To assign a macOS device via command line, please follow the instructions below:
sudo /Applications/TeamViewerHost.app/Contents/Helpers/TeamViewer_Assignment -assignment_id <ID> --offline
Example:
sudo /Applications/TeamViewerHost.app/Contents/Helpers/TeamViewer_Assignment -assignment_id 0001CoBBChARKJtw_okR6o_fJ7AisynpEigIACAfAgAJAOjwtNCVK_JiM5lVdgdfguSk-gQ= --offline
sudo /Applications/TeamViewer.app/Contents/Helpers/TeamViewer_Assignment -assignment_id paste_your_assignment_id_here --offline
Example:
sudo /Applications/TeamViewer.app/Contents/Helpers/TeamViewer_Assignment -assignment_id 0001CoBBChARKJtw_okR6o_fJ7AisynpEigIACAfAgAJAOjwtNCVK_JiM5lVdgdfguSk-gQ= --offline
This is an additional option you can add to your command line:
-device_alias [<name>]
Alias for the new device in the Device list. No alias will be applied if the device is already in the contact list. The property can take the following values:
To handle devices that are offline during the assignment, it stores the assignment in the registry as an encrypted property and executes it automatically when the device comes online. This property is deleted once the device is successfully assigned.
sudo teamviewer assignment --id paste_your_assignment_id_here --offline
Example:
sudo teamviewer assignment --id 0001CoABChARKJtw_okR6o_fJ7AisynpEigIACAfAgAJAO4PLaOBrqNDgr6jwtNCVK_JiM5lVdgdfgYo3uQ3pGkAbX8bo_VqPw1Rt61-RLe9AKSwZ14uwOXtUN7FYflrHbWAqRKBF0h8V18ldMcVT1rLF --offline
This is an additional option you can add to your command line:
--device_alias [<name>]
Alias for the new device in the Device list. No alias will be applied if the device is already in the contact list. The property can take the following values:
To handle devices that are offline during the assignment, it stores the assignment in the registry as an encrypted property and executes it automatically when the device comes online. This property is deleted once the device is successfully assigned.
If you have an assigned device already and execute the assignment via the command line again, the device assignment gets overwritten by the new one. Overwriting implies that the old assignment is deleted, and already assigned managers or policies will be lost.
Note: The TeamViewer policy "prevents removal of assignment" also prevents a new assignment on an already assigned device.