<main>
<article class="userContent">
<p>Automating your scripts saves time on repetitive tasks, such as uploading your batch, PowerShell, or shell scripts encrypted into secure storage within the <a href="https://login.teamviewer.com/?_ga=2.217682966.1499139972.1671438772-2025583914.1666017428" rel="nofollow noreferrer ugc">Management Console</a>.</p><p>Select the saved scripts from the menu during remote sessions and start the execution with one click.</p><p>You can also standardize maintenance and support while reducing time to resolution, using your saved time to focus more on essential tasks or resolving other support requests.</p><p>With OneClick remote script execution, you can regain productivity and help more clients.</p><div class="blockquote"><div class="blockquote-content"><p class="blockquote-line"><em>This article applies to TeamViewer customers with a TeamViewer </em><a href="https://community.teamviewer.com/English/home/leaving?target=https%3A%2F%2Fwww.teamviewer.com%2Fen%2Fbuy-now%2F" rel="nofollow noreferrer ugc"><em>subscription plan</em></a><em>.</em></p></div></div><p><br></p><h3></h3><h2 data-id="oneclick-remote-script-execution-introduction-video">OneClick remote script execution - Introduction video</h2><div class="js-embed embedResponsive" data-embedjson="{"height":337,"width":600,"url":"https:\/\/cdn.embedly.com\/widgets\/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FQNubF0cCr_s%3Ffeature%3Doembed&display_name=YouTube&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQNubF0cCr_s&image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FQNubF0cCr_s%2Fhqdefault.jpg&key=b0d40caa4f094c68be7c29880b16f56e&type=text%2Fhtml&schema=youtube","embedType":"iframe"}">
<a href="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FQNubF0cCr_s%3Ffeature%3Doembed&display_name=YouTube&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQNubF0cCr_s&image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FQNubF0cCr_s%2Fhqdefault.jpg&key=b0d40caa4f094c68be7c29880b16f56e&type=text%2Fhtml&schema=youtube" rel="nofollow noreferrer ugc">
https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FQNubF0cCr_s%3Ffeature%3Doembed&display_name=YouTube&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQNubF0cCr_s&image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FQNubF0cCr_s%2Fhqdefault.jpg&key=b0d40caa4f094c68be7c29880b16f56e&type=text%2Fhtml&schema=youtube
</a>
</div><p><br></p><h3 data-id="-1"></h3><h2 data-id="general-requirements">General Requirements</h2><p>The following requirements must be met to upload scripts to the Management Console. Please make sure that you fulfill all:</p><ul><li>A valid TeamViewer subscription</li><li>Scripts already created and saved locally on your current device (that you intend to use to upload the scripts to the Management Console)</li><li>The script file size is less than 100 kB.</li></ul><p><br></p><h3 data-id="-2"></h3><h2 data-id="how-to-upload-scripts">How to upload scripts</h2><p>To upload scripts, please follow the instructions below:</p><ol><li>Log in to the Management Console: <a href="https://login.teamviewer.com/" rel="nofollow noreferrer ugc">https://login.teamviewer.com/</a>.</li><li>Click on <strong>Scripts </strong>at the top left of the side menu.</li><li>Click <strong>+Add script </strong>to upload your script.<ul><li>If you have already uploaded some scripts, they will be displayed in a table. </li></ul></li><li><strong>Select the script file</strong>, enter the required information in the dedicated fields and click <strong>Save</strong>.</li></ol><div class="embedExternal embedImage display-large float-none">
<div class="embedExternal-content">
<a class="embedImage-link" href="https://us.v-cdn.net/6032394/uploads/SE1UL3T3R27C/image.png" rel="nofollow noreferrer noopener ugc" target="_blank">
<img class="embedImage-img" src="https://us.v-cdn.net/6032394/uploads/SE1UL3T3R27C/image.png" alt="image.png" height="301" width="1188" loading="lazy" data-display-size="large" data-float="none"></img></a>
</div>
</div>
<h4 data-id="run-as-administrator">Run as administrator</h4><p>Check this box to run the script as administrator. Scripts using at least one command that requires elevated rights should have this box checked. </p><p>When initiating a script, a prompt appears once at the start of execution asking for permission (if the logged-in user already has administrative rights) or for administrator credentials (if the logged-in user does not have administrative rights). Regardless of how often/when commands are used in the script (e.g., for long-running tasks), this only appears once at the beginning.</p><p>⚠ <strong>Important notes:</strong></p><ul><li>It is not currently possible to execute scripts using administrative rights if TeamViewer is used in <strong>Run only (one-time use) mode</strong> or via <strong>QuickSupport,</strong> as the UAC prompts cannot be displayed via the session. TeamViewer must be installed on the device itself.</li><li>Scripts in administrative mode are not yet supported for Linux.</li></ul><h4 data-id="script-types">Script types</h4><p>Once the above is entered, the next step is to upload the script using the <strong>Upload Script</strong> button. The following script types are currently supported:</p><h5 data-id="windows">Windows</h5><ul><li>Batch <strong>(.bat/.cmd)</strong></li><li>Powershell <strong>(.ps1)</strong></li></ul><h5 data-id="macos">macOS</h5><ul><li>Shell <strong>(.sh)</strong></li></ul><h5 data-id="linux">Linux</h5><ul><li>Bash <strong>(.sh)</strong></li></ul><p><br></p><h3 data-id="-3"></h3><h2 data-id="how-to-update-scripts">How to update scripts</h2><p>Hover the mouse over the desired script to modify and delete existing scripts. To the right of the script, a pencil icon and a trashcan icon will appear. These will allow you to <strong>Edit</strong> or <strong>Delete </strong>the script.</p><div class="embedExternal embedImage display-large float-none">
<div class="embedExternal-content">
<a class="embedImage-link" href="https://us.v-cdn.net/6032394/uploads/LGMJ9EDBNVAL/image.png" rel="nofollow noreferrer noopener ugc" target="_blank">
<img class="embedImage-img" src="https://us.v-cdn.net/6032394/uploads/LGMJ9EDBNVAL/image.png" alt="image.png" height="382" width="1607" loading="lazy" data-display-size="large" data-float="none"></img></a>
</div>
</div>
<p>The new data is saved when a script is modified (either a new version of the script is uploaded or the information is changed). Old script data is deleted.</p><p><br></p><h3 data-id="-4"></h3><h2 data-id="how-to-execute-scripts">How to execute scripts</h2><h3 data-id="prerequisites">Prerequisites</h3><p>The following requirements must be met to automate your tasks with scripts. Please make sure that you fulfill all:</p><ul><li>A valid TeamViewer subscription.</li><li>Both machines must run TeamViewer 14 or later.</li><li>Logged into your TeamViewer client with a licensed account (scripts will not appear in the menu otherwise).</li><li>The scripts are marked as suitable for the remote machine operating system.</li><li><strong>For Windows:</strong> The remote TeamViewer client must be installed and not operated in "Run only" mode. This is required to run scripts that require <a href="https://community.teamviewer.com/English/kb/articles/45793-oneclick-remote-script-execution-scripts-for-automation#upload-process-in-the-management-console" rel="nofollow noreferrer ugc">Administrative rights</a>.</li><li>HTTP connection from the remote system to the cloud storage must be possible.</li></ul><p><br></p><h3 data-id="execute-scripts">Execute scripts</h3><p>To execute scripts, establish a TeamViewer connection to your remote device and follow the instructions below:</p><ol><li>Open the <strong>scripts</strong> <strong>menu</strong><ul><li><strong>Windows:</strong> Go to <strong>Actions</strong> <strong>> Scripts </strong>in the remote control toolbar to open the menu.</li><li><strong>macOS:</strong> Click <strong>Scripts </strong>on the right-hand side of the remote control toolbar.</li><li>The drop-down menu will show all compatible uploaded scripts for the remote machine's operating system.</li></ul></li><li> <strong>Select a script</strong> to run on the remote machine by clicking on the context menu.</li><li>The <strong>remote user </strong>must <strong>accept </strong>the <strong>script execution </strong>request dialogue. Once accepted, the script is downloaded to the remote machine directly from the cloud, decrypted, and started.<ul><li>On the remote side, some notifications are shown for the current status.</li><li>If the script needs administrative rights, a dialogue will ask for permission. This only appears once per session</li></ul></li></ol><p><br></p><h3 data-id="-5"></h3><h2 data-id="permission-management-for-unattended-devices">Permission management for unattended devices </h2><p>By default, scripts can only be executed if the user on the remote side accepts the execution request. In situations where a script must be executed on an unattended device or where the user cannot accept the request, the request can be disabled completely or set always to deny script execution via the new access control.</p><p>Permissions can be defined for both incoming and outgoing connections. This setting can only be changed if administrative rights are active, meaning this setting can be used to restrict script execution abilities from those in your company who do not require it.</p><p>The following defaults are set if access control is chosen:</p><div class="embedExternal embedImage display-large float-none">
<div class="embedExternal-content">
<a class="embedImage-link" href="https://us.v-cdn.net/6032394/uploads/GMGSYLIF8OE6/image.png" rel="nofollow noreferrer noopener ugc" target="_blank">
<img class="embedImage-img" src="https://us.v-cdn.net/6032394/uploads/GMGSYLIF8OE6/image.png" alt="image.png" height="163" width="691" loading="lazy" data-display-size="large" data-float="none"></img></a>
</div>
</div>
<p>Custom settings can be defined using the following values:</p><div class="embedExternal embedImage display-large float-none">
<div class="embedExternal-content">
<a class="embedImage-link" href="https://us.v-cdn.net/6032394/uploads/AXISC04HO2AF/image.png" rel="nofollow noreferrer noopener ugc" target="_blank">
<img class="embedImage-img" src="https://us.v-cdn.net/6032394/uploads/AXISC04HO2AF/image.png" alt="image.png" height="181" width="693" loading="lazy" data-display-size="large" data-float="none"></img></a>
</div>
</div>
<p>The access control allowed in a session depends on the setting of both the local and remote machines. In situations where access control differs, the most restrictive setting of the two will be used.</p><p><br></p><h3 data-id="manage-access-control-on-windows">Manage Access Control on Windows</h3><p>To verify or alter Access Control permissions on Windows:</p><ol><li>Access the <strong>TeamViewer options (⚙)</strong> in the upper right corner of the TeamViewer app.</li><li>Click on <strong>Advanced</strong>, navigate to<strong> Advanced settings for connections to this computer, </strong>or <strong>Advanced settings for other computers</strong>.</li><li> In Access Control, <strong>select </strong>the desired <strong>setting </strong>and click <strong>OK</strong>. </li></ol><p><br></p><h3 data-id="manage-access-control-on-macos">Manage Access Control on macOS</h3><p>To verify or alter Access Control permissions on macOS:</p><ol><li>Open <strong>TeamViewer.</strong></li><li>Click <strong>TeamViewer </strong>at the top left corner of your screen and select <strong>Preferences</strong>.</li><li>Click on <strong>Advanced</strong>, navigate to<strong> Advanced settings for connections to this computer, </strong>or <strong>Advanced settings for other computers</strong>.</li><li> In Access Control, <strong>select </strong>the desired <strong>setting </strong>and click <strong>OK</strong>. </li></ol><p><br></p><h3 data-id="manage-access-control-on-linux">Manage Access Control on Linux</h3><p>To check or adapt the permissions on Linux:</p><ol><li>Open <strong>TeamViewer</strong>.</li><li>Access the <strong>TeamViewer Options.</strong></li><li>Click on <strong>Advanced</strong>, navigate to<strong> Advanced settings for connections to this computer, </strong>or <strong>Advanced settings for other computers</strong>.</li><li> In Access Control, <strong>select </strong>the desired <strong>setting </strong>and click <strong>OK</strong>. </li></ol><p>📌<strong>Note: Advanced settings for connections to this computer</strong> are the only current option available for Linux, as it is not yet possible to execute scripts <em>from</em> a Linux device.</p><p><br></p><h3 data-id="manage-access-control-via-teamviewer-policy">Manage Access Control via TeamViewer policy</h3><p>It is also possible to manage the Access Control settings from a TeamViewer policy. This allows you to affect the same settings on multiple devices at once.</p><p>You'll learn how to create a TeamViewer policy here: <a href="https://community.teamviewer.com/English/kb/articles/4860-create-a-settings-policy" rel="nofollow noreferrer ugc">Create a settings policy</a>. Once the policy is created, you can:</p><ul><li>Add <strong>Access Control (incoming connections)</strong> or <strong>Access Control (outgoing connections)</strong> to the policy.</li><li>Manage the setting for <strong>Execute Scripts.</strong></li></ul><div class="embedExternal embedImage display-large float-none">
<div class="embedExternal-content">
<a class="embedImage-link" href="https://us.v-cdn.net/6032394/uploads/LRT4HAXNDAX8/image.png" rel="nofollow noreferrer noopener ugc" target="_blank">
<img class="embedImage-img" src="https://us.v-cdn.net/6032394/uploads/LRT4HAXNDAX8/image.png" alt="image.png" height="792" width="1297" loading="lazy" data-display-size="large" data-float="none"></img></a>
</div>
</div>
<p>Once saved, the policy can be assigned using <strong>Assign TeamViewer policies</strong>. </p><p>More information on creating and deploying a TeamViewer policy can be found here:</p><h4 data-id="create-a-settings-policy">📄 <a href="https://community.teamviewer.com/English/kb/articles/4860-create-a-settings-policy" rel="nofollow noreferrer ugc">Create a settings policy</a></h4><h4 data-id="assign-a-settings-policy-to-your-devices">📄 <a href="https://community.teamviewer.com/English/kb/articles/109297-assign-a-settings-policy-to-your-devices" rel="nofollow noreferrer ugc">Assign a settings policy to your devices</a></h4><p><br></p><h3 data-id="-6"></h3><h2 data-id="scripts-are-not-available-within-a-session">Scripts are not available within a session</h2><p>The script menu will appear greyed out when you cannot execute scripts during a session. To discover why scripts are unavailable, hover your mouse over the Scripts menu. Examples are shown below.</p><h3 data-id="windows-1">Windows</h3><div class="embedExternal embedImage display-large float-none">
<div class="embedExternal-content">
<a class="embedImage-link" href="https://us.v-cdn.net/6032394/uploads/CWSCNKBSO6AI/image.png" rel="nofollow noreferrer noopener ugc" target="_blank">
<img class="embedImage-img" src="https://us.v-cdn.net/6032394/uploads/CWSCNKBSO6AI/image.png" alt="image.png" height="195" width="651" loading="lazy" data-display-size="large" data-float="none"></img></a>
</div>
</div>
<h3 data-id="macos-1">macOS</h3><div class="embedExternal embedImage display-large float-none">
<div class="embedExternal-content">
<a class="embedImage-link" href="https://us.v-cdn.net/6032394/uploads/8DOABMBPURH3/image.png" rel="nofollow noreferrer noopener ugc" target="_blank">
<img class="embedImage-img" src="https://us.v-cdn.net/6032394/uploads/8DOABMBPURH3/image.png" alt="image.png" height="126" width="629" loading="lazy" data-display-size="large" data-float="none"></img></a>
</div>
</div>
<p> </p><h3 data-id="-7"></h3><h2 data-id="best-practices-for-writing-your-scripts">Best practices for writing your scripts</h2><h3 data-id="using-'~'-for-paths-on-macos">Using '~' for paths on macOS</h3><p>macOS allows the character ‘~’ 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 <strong>/var/root</strong> and not with the logged-in user's home directory.</p><p>Furthermore, the <strong>$HOME variable</strong> is not set in this case. For these reasons, <strong>you should not rely on ‘~’ and $HOME if you run your scripts as administrator.</strong></p><p>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 <strong>~/Library/Application Support/TeamViewer/Remote Scripting/<script-uuid></strong></p><p>This directory will be deleted immediately after the executed script has terminated.</p><p>The root user also creates these files and folders. If necessary, you can change the owner with the <code class="code codeInline" spellcheck="false" tabindex="0">chown</code> command and change the rights with <code class="code codeInline" spellcheck="false" tabindex="0">chmod</code>.</p><h3 data-id="using-the-right-line-endings">Using the right line endings</h3><p>You must use the correct line endings in your script files that can be interpreted by the operating system on which you execute the scripts.</p><p>For example, a script file that contains “CR LF” like on Windows cannot be executed on Linux (expects only “LF”).</p><p><br></p><h3 data-id="-8"></h3><h2 data-id="faq">FAQ</h2><h3 data-id="why-is-my-powershell-script-not-executed-on-the-remote-machine-but-works-locally">Why is my PowerShell script not executed on the remote machine but works locally?</h3><p>By default, Windows restricts the execution of Powershell scripts. The execution policy must first be changed.</p><ul><li><strong>On 64-bit machines:</strong> Currently, the 32-bit process for the command line is used. For this, you have to set the permission on the 32-bit process: </li></ul><pre class="code codeBlock" spellcheck="false" tabindex="0">SystemRoot%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe "Set-ExecutionPolicy RemoteSigned".
</pre><p>(This issue will be fixed in a later version so that the 64-bit process is used.)</p><p>For further details, please have a look at the documentation for <a href="https://community.teamviewer.com/English/home/leaving?target=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fmicrosoft.powershell.security%2Fget-executionpolicy%3Fview%3Dpowershell-6" rel="nofollow noreferrer ugc">Get-ExecutionPolicy</a> and <a href="https://community.teamviewer.com/English/home/leaving?target=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fmicrosoft.powershell.security%2Fset-executionpolicy%3Fview%3Dpowershell-6" rel="nofollow noreferrer ugc">Set-ExecutionPolicy</a> </p>
</article>
</main>