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 a 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 you will be shown only those scripts within the menu in your sessions, that can be executed on the remote machine operating system you are connected to.
Windows and macOS are supported currently.
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.
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:
Scripts can only be executed if the user on the remote side accepts the execution request once per session. For unattended devices there is no user, who can acknowledge the request.
For this you have the possibility in the options / preferences to disable the request dialogue for this TeamViewer installation.
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.
Check the new setting Allow script execution without confirmation and exit with OK.
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