[GH-ISSUE #2048] [BUG] Env var from script manager are sent to agents checks #3218

Closed
opened 2026-03-14 06:53:15 +03:00 by kerem · 1 comment
Owner

Originally created by @P6g9YHK6 on GitHub (Oct 28, 2024).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/2048

Originally assigned to: @wh1te909 on GitHub.

Server Info (please complete the following information):

  • OS: [Debian 12
  • Browser: Edge
  • RMM Version (as shown in top left of web UI): 19.4

Installation Method:

  • Standard
  • Standard with --insecure flag at install
  • Docker

Agent Info (please complete the following information):

  • Agent version (as shown in the 'Summary' tab of the agent from web UI): v2.7.0
  • Agent OS: all

Describe the bug
Env var added in script manager are transferred to all active checks without warning nor possibility of disabling

To Reproduce
Steps to reproduce the behavior:

  1. set a check without any env var
  2. add var to script manager
  3. see output in the check with var enabled
  4. remove from the script manager and it will also be removed from active checks

Expected behavior
just like arguments, var should not be applied to 100% of scripts deployed !

Screenshots
image
image

image

Additional context

param (
    [switch]$Flag1,
    [switch]$Flag2
)

# Check environment variables and handle if they are not set
$EnvVar1 = [System.Environment]::GetEnvironmentVariable("EnvVar1")
$EnvVar2 = [System.Environment]::GetEnvironmentVariable("EnvVar2")

if (-not $EnvVar1) {
    Write-Output "Warning: EnvVar1 is not set."
} else {
    Write-Output "EnvVar1 is set to: $EnvVar1"
}

if (-not $EnvVar2) {
    Write-Output "Warning: EnvVar2 is not set."
} else {
    Write-Output "EnvVar2 is set to: $EnvVar2"
}

# Output results based on flags
if ($Flag1) {
    Write-Output "Flag1 is enabled."
} else {
    Write-Output "Flag1 is disabled."
}

if ($Flag2) {
    Write-Output "Flag2 is enabled."
} else {
    Write-Output "Flag2 is disabled."
}

Originally created by @P6g9YHK6 on GitHub (Oct 28, 2024). Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/2048 Originally assigned to: @wh1te909 on GitHub. **Server Info (please complete the following information):** - OS: [Debian 12 - Browser: Edge - RMM Version (as shown in top left of web UI): 19.4 **Installation Method:** - [X] Standard - [ ] Standard with `--insecure` flag at install - [ ] Docker **Agent Info (please complete the following information):** - Agent version (as shown in the 'Summary' tab of the agent from web UI): v2.7.0 - Agent OS: all **Describe the bug** Env var added in script manager are transferred to all active checks without warning nor possibility of disabling **To Reproduce** Steps to reproduce the behavior: 1. set a check without any env var 2. add var to script manager 3. see output in the check with var enabled 4. remove from the script manager and it will also be removed from active checks **Expected behavior** just like arguments, var should not be applied to 100% of scripts deployed ! **Screenshots** ![image](https://github.com/user-attachments/assets/bcfd071a-558f-4bcc-adb8-257e638e0c87) ![image](https://github.com/user-attachments/assets/5683209e-4538-435b-ad8f-0f53dc7ffdef) ![image](https://github.com/user-attachments/assets/f4a8c8bd-ea88-45cf-96aa-ec5c4c7bfee7) **Additional context** ``` param ( [switch]$Flag1, [switch]$Flag2 ) # Check environment variables and handle if they are not set $EnvVar1 = [System.Environment]::GetEnvironmentVariable("EnvVar1") $EnvVar2 = [System.Environment]::GetEnvironmentVariable("EnvVar2") if (-not $EnvVar1) { Write-Output "Warning: EnvVar1 is not set." } else { Write-Output "EnvVar1 is set to: $EnvVar1" } if (-not $EnvVar2) { Write-Output "Warning: EnvVar2 is not set." } else { Write-Output "EnvVar2 is set to: $EnvVar2" } # Output results based on flags if ($Flag1) { Write-Output "Flag1 is enabled." } else { Write-Output "Flag1 is disabled." } if ($Flag2) { Write-Output "Flag2 is enabled." } else { Write-Output "Flag2 is disabled." } ```
kerem 2026-03-14 06:53:15 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@wh1te909 commented on GitHub (Oct 29, 2024):

nice catch, just pushed the fix

<!-- gh-comment-id:2443183141 --> @wh1te909 commented on GitHub (Oct 29, 2024): nice catch, just pushed the fix
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#3218
No description provided.