This article applies to TeamViewer customers with a TeamViewer subscription plan.
All scripts that you want to use within a session need to be uploaded in the TeamViewer Management Console encrypted to cloud storage.
Please log in with your TeamViewer account to start.
There are some preconditions, that you must meet so that you can automate your tasks with scripts. Please make sure that you fulfill them all:
You can administer your scripts in the Management Console by clicking the Scripts menu item under Home in the upper left corner.
If you are new to using scripts, you can just start adding a script from the information page with the Add script button. If you have already uploaded some scripts, they will be displayed in a table.
The Add script button at the top of the table provides a new menu to add some information about the script and to select a script file.
You can add a short name and a longer meaningful description for your script. The name will be used for the menu within the session, while the description will be shown as a tooltip for a script menu entry so that you can provide some information about what the script does.
If you do not add any name, the script name (without the file ending) will be taken as default on file selection.
By choosing the operating system only those scripts within the menu in your sessions will be shown, that can be executed on the remote machine operating system you are connected to.
Windows, macOS, and Linux are currently supported.
If your script uses at least one command, that needs administrative rights (elevated mode on Windows), you should check the Run as administrator execution.
When you start a script, you are asked only once before the start of the execution for permission (if the logged in user already has administrative rights) or for administrator credentials (if the logged in user has no admin rights) regardless of how often or when such commands are used within your script (e.g. for long running tasks).
Currently, you are only able to execute scripts as administrator on an installed TeamViewer. On Windows "Run only (one time use)" option or QuickSupport it is not possible, because the UAC prompt cannot be displayed on the client side.
Scripts in administrative mode are not yet supported for Linux.
The following script types are currently supported
If you click the Save button, your script file is uploaded encrypted to the cloud storage. Your script data and the link to your script file are also stored encrypted.
You can modify and delete existing scripts by selecting the Edit or Delete function within the context menu for a script item. The context menu is shown if you hover over with the mouse at the end of the table:
If you modify an already existing script file or the script data, the changed file or data is saved instead of the old data. The old script file is deleted from the cloud storage.
If you start a TeamViewer session, you will have access to your scripts within a new script menu.
There are some prerequisites, that you must meet before you can automate your tasks with scripts. Please make sure that you fulfill them all:
Unfortunately, with the new access control for script execution, we had to break compatibility between 14.0/1 and 14.2. To ensure that scripts can be used, make sure that you have either on both sides, client and server, TeamViewer 14.0/14.1 installed or 14.2. A version 14.0/14.1 connecting to 14.2 or vice versa will not work.
The permission setting has changed in 14.2. If you are still using TV 14.0 or 14.1, please see the section below.
Per default, scripts can only be executed if the user on the remote side accepts the execution request. For unattended devices, there is no user, who can acknowledge the request.
For this, you have the possibility in the options/preferences as well as via TeamViewer policies to disable the request dialogue for this TeamViewer installation or to always deny the script execution via a new access control.
It’s not only possible for the incoming session to define the permission but also for the outgoing connections. As this setting can only be changed if you have administrative rights on your computer, this setting can be used to restrict the script execution for non-IT employees of your company.
If you choose an access control, the following defaults are set:
| Access Control | Execute scripts |
| Full Access | After confirmation |
| Confirm All |
After confirmation |
| View and Show |
Denied |
| Custom Settings |
After confirmation |
| Deny incoming remote control sessions |
Denied |
For Custom settings you can define by yourself which value should be used:
| Value for script execution | Description |
| Denied | Script execution is not allowed on this device. |
| After Confirmation |
Script execution is only allowed after the execution has been acknowledge on the remote side. |
| Allowed |
Script execution is always allowed on this device without any additional confirmation. |
The access controls of the local and remote TeamViewer are combined, which means that always the most restricting value of both sides is used.
To check or adapt the permissions on Windows go in the TeamViewer Client to Options > Advanced and then “Advanced settings for connections to this computer” or “Advanced settings for connections to other computers”.
To check or adapt the permissions on macOS go in the TeamViewer Client to the Preferences, select Advanced and then Advanced settings for connections to this computer or Advanced settings for connections to other computers.
To check or adapt the permissions on Linux go in the TeamViewer Client to Options --> Advanced and then Advanced settings for connections to this computer.
You have only the settings for the connections to this computer as starting scripts from a Linux machine is not yet available.
It’s now also possible to role out the settings via the TeamViewer Management Console to multiple devices at once.
Just define your policy in the Management Console and assign it to the devices in your Computers & Contacts list.
In the options/preferences, you have the possibility to disable the request dialogue for this TeamViewer installation with the setting for Allow script execution without confirmation.
This setting is no longer available with TV 14.2 and higher. There is no automatic migration done.
On Windows open the TeamViewer client and go to Extras --> Options in the menu. Select the Advanced tab and scroll down to the section Advanced settings for connections to this computer.
On macOS open the TeamViewer client and go to the Preferences in the menu. Select the Advanced tab and scroll down to the section Advanced settings for connections to this computer.
Check the new setting Allow script execution without confirmation and exit with Apply.
If you cannot run scripts within a session for some reason, the script menu is shown but is disabled. If you hover over with your mouse, you will find the reason for it in the tooltip that appears.
On macOS you can use ‘~’ to address the user's home directory. If scripts are executed with administrative rights, the script is executed by the root user. Therefore, ‘~’ will be replaced by /var/root and not with the home directory of the logged in user.
Furthermore, the $HOME variable is not set in this case. For these reasons, you should not rely on ‘~’ and $HOME if you run your scripts as administrator.
If you need to create, copy or download folders or files, you can use the working directory of the executed script which is located under ~/Library/Application Support/TeamViewer/Remote Scripting/<script-uuid>.
This directory will be deleted right after the executed script has terminated.
These files and folders are also created by the root user. If necessary you can change the owner with the chown command and change the rights with chmod.
It is important, that you are using the right line endings in your script files that can be interpreted by the operating system on which you execute the scripts.
For example, a script file that contains “CR LF” like on Windows cannot be executed on Linux (expects only “LF”).
SystemRoot%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe "Set-ExecutionPolicy RemoteSigned".(This issue will be fixed in a next version, so that the 64-bit process is used.)