# Executing scripts

### Preface

You can execute scripts on a per-client basis directly on the clients page. By selecting "scripts" on top navigation, you can execute scripts on many clients in parallel.&#x20;

![Two options for script execution](/files/-MgfvKmc3HBDcD04J6Aw)

### On Windows

Learn, from this video, how to execute PowerShell scripts on Windows machines (servers or desktop) – on a single machine and on multiple targets in parallel.

{% embed url="<https://vimeo.com/639533275>" %}
Execute PowerShell scripts with RPort
{% endembed %}

The video show how to install 7zip and notepad++ fully unattended with RPport using the following lines of PowerShell.

{% code title="install-7zip.ps1" %}

```powershell
iwr https://7-zip.org/a/7z1900-x64.msi -OutFile 7z1900-x64.msi
msiexec /i 7z1900-x64.msi /quiet /qn /norestart
sleep 10
Remove-Item -Path 7z1900-x64.msi -Force
if (Test-Path "C:\Program Files\7-Zip\7z.exe") {
    Write-Host "7zip installed"
}
```

{% endcode %}

{% code title="install-notepad++.ps1" %}

```powershell
if (Test-Path "C:\Program Files\Notepad++\notepad++.exe" -PathType leaf) {
    Write-Host "Notepad++ is already installed."
} 
else {
    cd $env:Temp
    iwr https://notepad-plus-plus.org/repository/7.x/7.0/npp.7.Installer.x64.exe -OutFile npp.7.Installer.x64.exe
    .\npp.7.Installer.x64.exe /S
    sleep 10
    rm npp.7.Installer.x64.exe -Force
    New-Item -ItemType SymbolicLink -Path "C:\Users\Public\Desktop\" -Name "notepad++.lnk" -Value "C:\Program Files\Notepad++\notepad++.exe"
    Write-Host "Notepad++ installed"
}
```

{% endcode %}

### On Linux

Type in the content of a script. You can use a regular shebang as first line like `#!/bin/bash` or `#!/usr/bin/env python3`.&#x20;

![Executing Python](/files/-MiVOOR2kTpMnNVSNLe1)

{% hint style="success" %}
If no shebang is given, `/bin/sh` is used to execute your script.
{% endhint %}

### Custom script interpreters

Starting with version 0.6.0 you can execute your scripts with an interpreter.&#x20;

Either enter the full path to the interpreter, or register available interpreters in the client's `rport.conf` file.

&#x20;To register a script interpreter on the `rport.conf` file on the client and append a list of available interpreters. After restarting the client, they get available on the user interface.

<div align="left"><img src="/files/yBeWwPNUQ7HjJS6FHsfb" alt="Execute with any interpreter"> <img src="/files/t6HBMlxtpaLn4xtyoSdd" alt="Register custom interpreters"></div>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kb.rport.io/digging-deeper/commands-and-scripts/executing-scripts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
