OneClick remote script execution - Scripts for automation

100% helpful (2/2)

This article applies to TeamViewer customers with a TeamViewer subscription plan

General

  • Save time on repetitive tasks by automating your scripts. Upload your batch, powershell, or shell scripts encrypted into secure storage within the Management Console.
  • During remote sessions, you can select saved scripts from the menu and start the execution with one click.
  • Standardize maintenance and support while reducing time to resolution.
  • Use your saved time to focus more on important tasks and resolving other support requests.
  • Regain your productivity and help more clients along the way.

OneClick remote script execution - Introduction video

Script upload in the TeamViewer Management Console

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.

Prerequisites for the TeamViewer Management Console

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:

  • For script usage you must have a valid license for TeamViewer 14.
  • Scripts are ready to use and saved on your local or network folders in a file.
  • The script file size is less than 100 kB.

Upload process in the TeamViewer Management Console

You can administer your scripts in the Management Console by clicking the Scripts menu item under Home in the upper left corner.. 

Scipt1.png

If you are new to using scripts, you can just start adding a script from the information page with the Add script button.  Script2.pngIf you have already uploaded some scripts, they will be displayed in a table. 

Script3.png

 

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. 

Script4.png

 

 

Name and description

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.

Operating system

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.

Run as administrator

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).

(warning) 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. 

Script types

The following script types are currently supported

  • On Windows
    • Batch (.bat, .cmd)
    • Powershell (.ps1)
  • On macOS
    • Shell (.sh)

Save

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.

Update

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: Script5.PNG

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.

Script execution within your sessions

If you start a TeamViewer session, you will have access to your scripts within a new script menu.

Prerequisites

There are some prerequisites, that you must meet, before you can automate your tasks with scripts. Please make sure that you fulfill them all:

  • For script usage you must have a valid license for TeamViewer 14.
  • The remote system you are connected to must have TeamViewer version 14.
  • You must be logged in the TeamViewer client with your licensed account (otherwise your scripts will not be displayed for the session).
  • The scripts, you want to run on the remote machine, must be marked as suitable for the remote machine operating system.
  • For Windows: The TeamViewer client on the remote side must be installed (not started with "Run only"). Otherwise, when running scripts that require administrative rights, the UAC prompt cannot be visible to the connecting client.
  • An HTTP connection from the remote system to the cloud storage must be possible.

Script execution

  • Establish a TeamViewer connection after the prerequisites listed above have been met.
  • Open the scripts menu.
    • Windows: In the client toolbar go to Actions and click the Scripts button to open the menu.Script6.png

       

    • macOS: In the menu bar go to Scripts.script7.png

       

  • All your uploaded scripts for your remote machine operating system will be shown in the displayed menu.
  • Select a script to run on the remote machine by clicking on the context menu.
  • Once per session: the remote user must accept the script execution request dialogue.
  • The script is downloaded to the remote machine from the cloud storage, decrypted and started.
  • If the script needs administrative rights, a dialogue will pop up to ask for permission.
  • On the remote side some notifications are shown for the current status.

Permission handling (especially for unattended devices)

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.

Windows

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

script8.PNG

macOS

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

script9.png

Scripts are not available within a session

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.

Windows

Check the new setting Allow script execution without confirmation and exit with OK

script10.png

 

macOS

script11.png

 

FAQ

Why is my Powershell script not executed on the remote machine but works fine locally?

    • On Windows the execution of Powershell scripts is restricted per default. You have to change the  Execution Policy first.
    • For further details, please have a look at the documentation for Get-ExecutionPolicy and Set-ExecutionPolicy 

 

 

 

Version history
Revision #:
5 of 5
Last update:
2 weeks ago
Updated by:
 
Contributors