Executing scripts

Learn how to execute scripts directly from the browser or via the API

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.

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.

Execute PowerShell scripts with RPort

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

install-7zip.ps1
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"
}
install-notepad++.ps1
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"
}

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.

If no shebang is given, /bin/sh is used to execute your script.

Custom script interpreters

Starting with version 0.6.0 you can execute your scripts with an interpreter.

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

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.

Last updated