[GH-ISSUE #2235] [Feature Request] Multiple Scripts in Script Editor #3336

Closed
opened 2026-03-14 07:08:58 +03:00 by kerem · 4 comments
Owner

Originally created by @adamjrberry on GitHub (May 27, 2025).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/2235

Is your feature request related to a problem? Please describe.
Not an issue, but would be neater. Currently, if creating a script that would be used by all three OS', you only have the option of picking one language and creating 1 script, unless you create 3 separate scripts.

Describe the solution you'd like
It would be cool if the 'Shell Type' dropdown had a 'Multiple Scripts' option or similar, and then the user could create individual scripts per OS within the overall script. This would allow a user to create 1 script that could use Powershell on Windows, Bash on Linux & MacOS etc. Editor could look similar to below:

Image

This would allow a user to select a script from the drop-down when executing a script in TRMM, and it will pick the correct script based on the OS.

Describe alternatives you've considered
Having separate scripts per OS - resulting in 3 scripts doing the same thing for different OS'
Using a cross-platform language - which is probably preferred but it's nice to still be able to use PS,bash etc..

Additional context
Screenshot above.

Originally created by @adamjrberry on GitHub (May 27, 2025). Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/2235 **Is your feature request related to a problem? Please describe.** Not an issue, but would be neater. Currently, if creating a script that would be used by all three OS', you only have the option of picking one language and creating 1 script, unless you create 3 separate scripts. **Describe the solution you'd like** It would be cool if the 'Shell Type' dropdown had a 'Multiple Scripts' option or similar, and then the user could create individual scripts per OS within the overall script. This would allow a user to create 1 script that could use Powershell on Windows, Bash on Linux & MacOS etc. Editor could look similar to below: ![Image](https://github.com/user-attachments/assets/8822473f-cc77-4377-94e6-66e660a8403e) This would allow a user to select a script from the drop-down when executing a script in TRMM, and it will pick the correct script based on the OS. **Describe alternatives you've considered** Having separate scripts per OS - resulting in 3 scripts doing the same thing for different OS' Using a cross-platform language - which is probably preferred but it's nice to still be able to use PS,bash etc.. **Additional context** Screenshot above.
kerem closed this issue 2026-03-14 07:09:03 +03:00
Author
Owner

@P6g9YHK6 commented on GitHub (May 27, 2025):

not tested trough trmm but works fine without

#!/bin/bash
 
@echo off
goto WindowsCode

if uname -a | grep -q "Darwin"; then
    echo "Mac Installer"
    if ! command -v brew >/dev/null 2>&1; then
        /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    fi
    brew install --cask firefox

elif uname -a | grep -qi "linux"; then
    echo "Linux Installer"
    if command -v snap >/dev/null 2>&1; then
        sudo snap install firefox
    else
        echo "Snap is not installed."
        exit 1
    fi
fi

echo "Install Complete"
exit 0

:WindowsCode
SetLocal EnableDelayedExpansion
echo "Windows Installer"
where choco >nul 2>nul
if %errorlevel% neq 0 (
    @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
)
choco install firefox -y
echo "Install Complete"
exit 0

Your friendly chaos code enjoyer.

edit:
chat gpt say use python y'a crazy

<!-- gh-comment-id:2912204260 --> @P6g9YHK6 commented on GitHub (May 27, 2025): not tested trough trmm but works fine without ``` #!/bin/bash @echo off goto WindowsCode if uname -a | grep -q "Darwin"; then echo "Mac Installer" if ! command -v brew >/dev/null 2>&1; then /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" fi brew install --cask firefox elif uname -a | grep -qi "linux"; then echo "Linux Installer" if command -v snap >/dev/null 2>&1; then sudo snap install firefox else echo "Snap is not installed." exit 1 fi fi echo "Install Complete" exit 0 :WindowsCode SetLocal EnableDelayedExpansion echo "Windows Installer" where choco >nul 2>nul if %errorlevel% neq 0 ( @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" ) choco install firefox -y echo "Install Complete" exit 0 ``` Your friendly chaos code enjoyer. edit: chat gpt say use python y'a crazy
Author
Owner

@NiceGuyIT commented on GitHub (May 30, 2025):

Using a cross-platform language - which is probably preferred but it's nice to still be able to use PS,bash etc..
I spent a year trying to find a good cross-platform language and submitted a PR to add Nushell and Deno to the agent. This is in place today.

Nushell is by far the best language out there. It supports many file formats natively, supports http requests, has a robust set of commands built in, and has a plugin system to add extra flexibility not available natively.

If you want OS specific functionality, call the OS-specific commands. For Windows, call Powershell and ConvertTo-Json to convert the output to JSON for processing. For Linux and maybe macOS, install jc to run commands that output JSON.

If that's not enough, Nushell has native support for SQLite! And the stor commands give you access to an in-memory SQLite database, essential for storing secrets across function calls.

While Nushell is a scripting language, Deno is a programming language and brings in the rich NPM ecosystem. Deno is a single binary and the deno compile command creates a single binary! This means you can write a program to call deno compile https://github.com/example/repo/src/main.js to create a single binary that can be used for startup or login commands, scheduled tasks, etc. While the NPM ecosystem is useful for web things, it is less useful for MSP things. I included it because it's a single binary that is cross platform.

Thinking about what can be done with the web, deno serve will start a web server for interactive usage. Imagine opening a page that Deno is serving, the user enters information like a problem ticket, and Deno sends it to your ticketing system. The only limitation is your lack of knowledge about what is possible.

Going back to your original question about having 3 different scripts for each OS, you can do that today with script snippets. Create a separate snippet for each OS and then include it in the main script with Nushell. Depending on how you write the snippet, Nushell can save the script and then execute it or execute it directly.

I hope this opened your mind to what's possible. If you are interested in learning more about Nushell, they have an active Discord with very friendly people. Be careful, once you go Nushell, you will never go back!

<!-- gh-comment-id:2920849998 --> @NiceGuyIT commented on GitHub (May 30, 2025): > Using a cross-platform language - which is probably preferred but it's nice to still be able to use PS,bash etc.. I spent a year trying to find a good cross-platform language and submitted a PR to add Nushell and Deno to the agent. This is in place today. Nushell is by far the best language out there. It supports many [file formats][1] natively, supports [http requests][3], has a robust [set of commands][4] built in, and has a [plugin system][5] to add extra flexibility not available natively. If you want OS specific functionality, call the OS-specific commands. For Windows, call Powershell and [ConvertTo-Json][2] to convert the output to JSON for processing. For Linux and maybe macOS, install [jc][6] to run commands that output JSON. If that's not enough, Nushell has native support for [SQLite][7]! And the [stor][8] commands give you access to an in-memory SQLite database, essential for storing secrets across function calls. While Nushell is a scripting language, Deno is a programming language and brings in the rich [NPM][9] ecosystem. Deno is a single binary and the [deno compile][10] command creates a single binary! This means you can write a program to call `deno compile https://github.com/example/repo/src/main.js` to create a single binary that can be used for startup or login commands, scheduled tasks, etc. While the NPM ecosystem is useful for web things, it is less useful for MSP things. I included it because it's a single binary that is cross platform. Thinking about what can be done with the web, [deno serve][11] will start a web server for interactive usage. Imagine opening a page that Deno is serving, the user enters information like a problem ticket, and Deno sends it to your ticketing system. The only limitation is your lack of knowledge about what is possible. Going back to your original question about having 3 different scripts for each OS, you can do that today with [script snippets][12]. Create a separate snippet for each OS and then include it in the main script with Nushell. Depending on how you write the snippet, Nushell can save the script and then execute it or execute it directly. I hope this opened your mind to what's possible. If you are interested in learning more about Nushell, they have an active Discord with very friendly people. Be careful, once you go Nushell, you will never go back! [1]: https://www.nushell.sh/commands/categories/formats.html [2]: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/convertto-json [3]: https://www.nushell.sh/commands/docs/http.html [4]: https://www.nushell.sh/commands/ [5]: https://www.nushell.sh/book/plugins.html#core-plugins [6]: https://kellyjonbrazil.github.io/jc/docs/ [7]: https://www.nushell.sh/commands/docs/query_db.html [8]: https://www.nushell.sh/commands/docs/stor.html [9]: https://www.npmjs.com/ [10]: https://docs.deno.com/runtime/reference/cli/compile/ [11]: https://docs.deno.com/runtime/reference/cli/serve/ [12]: https://docs.tacticalrmm.com/functions/scripting/#script-snippets
Author
Owner

@adamjrberry commented on GitHub (May 31, 2025):

Hi @NiceGuyIT , that's some interesting reading and admittedly I have never used the Nushell or Deno options in the TRMM Scripting IDE. That does indeed sound like a great solution, and I did mention the possibility of using a cross-platform language in my original post.
I raised the feature request really as a 'nice to have' rather than a 'need' , at least for me personally. I have built some cross-platform scripts with the likes of Python etc which worked well. I was using another platform that had this function where you click 'New Script' and then it gives you the option of defining an individual script per OS, which felt neat.
However, it looks like the snippets that you mention may fulfil that requirement anyway!
Really appreciate the in-depth comment and I will definitely play around with Nushell - it looks incredibly powerful!
Cheers :-) - I'll close this FR now as it looks like it's probably redundant with the available options.

<!-- gh-comment-id:2924891165 --> @adamjrberry commented on GitHub (May 31, 2025): Hi @NiceGuyIT , that's some interesting reading and admittedly I have never used the Nushell or Deno options in the TRMM Scripting IDE. That does indeed sound like a great solution, and I did mention the possibility of using a cross-platform language in my original post. I raised the feature request really as a 'nice to have' rather than a 'need' , at least for me personally. I have built some cross-platform scripts with the likes of Python etc which worked well. I was using another platform that had this function where you click 'New Script' and then it gives you the option of defining an individual script per OS, which felt neat. However, it looks like the snippets that you mention may fulfil that requirement anyway! Really appreciate the in-depth comment and I will definitely play around with Nushell - it looks incredibly powerful! Cheers :-) - I'll close this FR now as it looks like it's probably redundant with the available options.
Author
Owner

@silversword411 commented on GitHub (Jun 1, 2025):

Nushell is by far the best language out there. It supports many file formats natively, supports http requests, has a robust set of commands built in, and has a plugin system to add extra flexibility not available natively.

Have you done any performance comparisons between the languages yet?

PS is super slow, py is usually 20x faster

Love these writeups, keep 'em coming! I'll dive into the new-nu sometime soon

<!-- gh-comment-id:2927518005 --> @silversword411 commented on GitHub (Jun 1, 2025): > Nushell is by far the best language out there. It supports many [file formats](https://www.nushell.sh/commands/categories/formats.html) natively, supports [http requests](https://www.nushell.sh/commands/docs/http.html), has a robust [set of commands](https://www.nushell.sh/commands/) built in, and has a [plugin system](https://www.nushell.sh/book/plugins.html#core-plugins) to add extra flexibility not available natively. Have you done any performance comparisons between the languages yet? PS is super slow, py is usually 20x faster Love these writeups, keep 'em coming! I'll dive into the new-nu sometime soon
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tacticalrmm#3336
No description provided.