Knowledge Base
Assign existing TeamViewer installations via command line
Last Modified 2 апр. 2026 г.
How to assign a device via command line
To assign a Windows device via command line, please follow the instructions below:
- Open the CMD.
- Navigate to your TeamViewer installation folder.
- Enter the following command (indicated below) into the command line.
- Press Enter on your keyboard.
- (optional) Type
echo %errorlevel%
into the command line to verify if the process was successful:
- If the assignment was successful, the value "0" should be returned to the command line.
- Any other return value indicates a problem that occurred during the assignment. For more information, please refer to the Error codes section.
TeamViewer.exe assignment --id paste_your_assignment_id_here --offline
Example:
TeamViewer.exe assignment --id 0001CoBBChARKJtw_okR6o_fJ7AisynpEigIACAfAgAJAOjwtNCVK_JiM5lVdgdfguSk-gQ= --offline
Optional command line options
There are additional options you can add to your command line:
Alias
--device-alias=[<name>]
Alias for the new device as it will appear in the Device list; this property can take the following values:
- --alias (without value)
- alias of the computer will be the TeamViewer ID
- --alias hello
- alias of the computer will be "hello"
- Alias parameter not specified
- alias of this computer will be %computername%
- --alias %systemvariable%
- alias will be the used system variable e.g. %username%
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%“
Retries
--retries
The assignment is retried in case of temporary errors. Note that there is a waiting time of 1 second between each try.
Timeout
--timeout
Set the overall timeout in seconds used for all assignment tries.
Example:
TeamViewer.exe assignment --id YOUR_ASSIGNMENT_ID
--retries=3 --timeout=120
For offline devices
--offline
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.
For reassignment with the same assignment ID
--reassign
This parameter allows you to reassign a device using the same assignment ID. By default, devices reject reassignment attempts if the assignment ID has not changed. Using --reassign enforces the existing assignment ID on the device, which can be useful in scenarios where the assignment needs to be re-applied without generating a new assignment ID.
Error codes
| Error code | Description | Problem/solution |
|---|---|---|
1 | Invalid command line arguments | You seem to have misspelled or used a wrong command. Check your command and try again. |
2 | Signature verification error | - |
3 | Product not installed | TeamViewer is not installed. Install TeamViewer before doing an assignment. |
4 | Service config - access failed | // ComAPI The assignment configuration could not be verified against the TeamViewer Cloud. Please try again later. |
400 (40 under Linux/FreeBSD) | MDv2Assignment - invalid argument | There seems to be an error in the command line syntax or an invalid assignment ID is used. Please check your overall command line syntax and verify that the copied assignment ID is a valid configuration from the Management Console. |
401 (41 under Linux/FreeBSD) | MDv2Assignment - service not running | The assignment can't be done because TeamViewer is not running properly. Please verify that the TeamViewer service is running. |
402 (42 under Linux/FreeBSD) | MDv2Assignment - service incompatible version | The TeamViewer service is incompatible with the executed TeamViewer client version. It seems that the installation wasn't completed properly. Please check the installation and if necessary re-install TeamViewer again. |
403 (43 under Linux/FreeBSD) | MDv2Assignment - not online | The TeamViewer client could not connect to the TeamViewer cloud in order to assign your device. Please check if the client is online and if your internet connection works properly and re-try the assignment. Consider using the retries option on the command line interface if that happens frequently. |
404 (44 under Linux/FreeBSD) | MDv2Assignment - already running | Another assignment process is already running. Please check the status of that assignment. You can do that for example by checking if the device is already registered as a managed device in the Management Console. |
405 (45 under Linux/FreeBSD) | MDv2Assignment - timeout | Your assignment attempt was timed out. Please try again. Consider increasing the timeout on the command line interface in case this happens frequently and/or the network is unstable e.g. mobile ones. |
406 (46 under Linux/FreeBSD) | MDv2Assignment - failed | Your assignment failed due to unknown reasons. Please save your logs and contact support. |
407 (47 under Linux/FreeBSD) | MDv2Assignment - access denied | You don't have the necessary permission to execute an assignment. Ensure that your user has local administrator rights. |
408 (48 under Linux/FreeBSD) | MDv2Assignment - Denied by policy | The TeamViewer policy active on this device prevents removing the existing assignment state. Please disable the policy in the Management Console. |
409 | MDv2Assignment - Device already managed | The device is already assigned to your company with the same assignment ID. |
Prerequisites:
- TeamViewer is already installed.
- For TeamViewer full client, the option Start with macOS needs to be enabled.
To assign a macOS device via command line, please follow the instructions below:
- Open the Terminal.
- Enter the following command (indicated below) into the command line.
- Press Enter on your keyboard.
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
Optional command line option
This is an additional option you can add to your command line:
Alias
-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:
- --alias (without value)
- alias of the computer will be the TeamViewer ID
- --alias hello
- alias of the computer will be "hello"
--offline
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.
For reassignment with the same assignment ID
--reassign
This parameter allows you to reassign a device using the same assignment ID. By default, devices reject reassignment attempts if the assignment ID has not changed. Using --reassign enforces the existing assignment ID on the device, which can be useful in scenarios where the assignment needs to be re-applied without generating a new assignment ID.
sudo teamviewer assignment --id paste_your_assignment_id_here --offline
Example:
sudo teamviewer assignment --id 0001CoABChARKJtw_okR6o_fJ7AisynpEigIACAfAgAJAO4PLaOBrqNDgr6jwtNCVK_JiM5lVdgdfgYo3uQ3pGkAbX8bo_VqPw1Rt61-RLe9AKSwZ14uwOXtUN7FYflrHbWAqRKBF0h8V18ldMcVT1rLF --offline
Optional command line option
This is an additional option you can add to your command line:
Alias
--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:
- --alias (without value)
- alias of the computer will be the TeamViewer ID
- --alias hello
- alias of the computer will be "hello"
--offline
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.
For reassignment with the same assignment ID
--reassign
This parameter allows you to reassign a device using the same assignment ID. By default, devices reject reassignment attempts if the assignment ID has not changed. Using --reassign enforces the existing assignment ID on the device, which can be useful in scenarios where the assignment needs to be re-applied without generating a new assignment ID.
Error codes
| Error code | Description | Problem/solution |
|---|---|---|
400 (40 under Linux/FreeBSD) | MDv2Assignment - invalid argument | There seems to be an error in the command line syntax or an invalid assignment ID is used. Please check your overall command line syntax and verify that the copied assignment ID is a valid configuration from the Management Console. |
401 (41 under Linux/FreeBSD) | MDv2Assignment - service not running | The assignment can't be done because TeamViewer is not running properly. Please verify that the TeamViewer service is running. |
402 (42 under Linux/FreeBSD) | MDv2Assignment - service incompatible version | The TeamViewer service is incompatible with the executed TeamViewer client version. It seems that the installation wasn't completed properly. Please check the installation and if necessary re-install TeamViewer again. |
403 (43 under Linux/FreeBSD) | MDv2Assignment - not online | The TeamViewer client could not connect to the TeamViewer cloud in order to assign your device. Please check if the client is online and if your internet connection works properly and re-try the assignment. Consider using the retries option on the command line interface if that happens frequently. |
404 (44 under Linux/FreeBSD) | MDv2Assignment - already running | Another assignment process is already running. Please check the status of that assignment. You can do that for example by checking if the device is already registered as a managed device in the Management Console. |
405 (45 under Linux/FreeBSD) | MDv2Assignment - timeout | Your assignment attempt was timed out. Please try again. Consider increasing the timeout on the command line interface in case this happens frequently and/or the network is unstable e.g. mobile ones. |
406 (46 under Linux/FreeBSD) | MDv2Assignment - failed | Your assignment failed due to unknown reasons. Please save your logs and contact support. |
407 (47 under Linux/FreeBSD) | MDv2Assignment - access denied | You don't have the necessary permission to execute an assignment. Ensure that your user has local administrator rights. |
408 (48 under Linux/FreeBSD) | MDv2Assignment - Denied by policy | The TeamViewer policy active on this device prevents removing the existing assignment state. Please disable the policy in the Management Console. |
How to update/overwrite an assignment
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.