[GH-ISSUE #1614] Script Manager: Run As User flag is ignored when using environmental variables #1010

Closed
opened 2026-03-02 02:20:34 +03:00 by kerem · 2 comments
Owner

Originally created by @NiceGuyIT on GitHub (Aug 24, 2023).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/1614

Originally assigned to: @wh1te909 on GitHub.

Server Info (please complete the following information):

  • OS: Ubuntu 20.04.4 LTS (Focal Fossa)
  • Browser: Firefox 116.0.2 (64-bit)
  • RMM Version (as shown in top left of web UI): v0.16.3

Installation Method:

  • Standard
  • Docker

Agent Info (please complete the following information):

  • Agent version (as shown in the 'Summary' tab of the agent from web UI): Agent v2.4.11
  • Agent OS: Opensuse-Leap 15.4

Describe the bug
The scripting system ignores the Run As User flag when using environmental variables. Running Get-ChildItem ENV: produces identical output regardless if the Run As User is checked IF there are environmental variables.

To Reproduce
Steps to reproduce the behavior:

  1. Create a PowerShell script to dump all the environmental variables: Get-ChildItem ENV:
  2. Do not check Run As User.
  3. Add an environmental variable.
  4. Run the script and save the output. Pay attention to the USERNAME, USERPROFILE, and other user specific variables.
  5. Check Run As User.
  6. Run the script and save the output. Pay attention to the USERNAME, USERPROFILE, and other user specific variables.
  7. Notice the user specific variables did not change.
  8. Leave Run As User checked and remove the environmental variable.
  9. Run the script and save the output. Pay attention to the USERNAME, USERPROFILE, and other user specific variables.
  10. Notice the user specific variables now reflect the logged in user.

Expected behavior
I expected the environmental variables to reflect the logged in user when Run As User is checked.

Screenshots
N/A

Additional context
N/A

Originally created by @NiceGuyIT on GitHub (Aug 24, 2023). Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/1614 Originally assigned to: @wh1te909 on GitHub. **Server Info (please complete the following information):** - OS: Ubuntu 20.04.4 LTS (Focal Fossa) - Browser: Firefox 116.0.2 (64-bit) - RMM Version (as shown in top left of web UI): v0.16.3 **Installation Method:** - [x] Standard - [ ] Docker **Agent Info (please complete the following information):** - Agent version (as shown in the 'Summary' tab of the agent from web UI): Agent v2.4.11 - Agent OS: Opensuse-Leap 15.4 **Describe the bug** The scripting system ignores the Run As User flag when using environmental variables. Running `Get-ChildItem ENV:` produces identical output regardless if the Run As User is checked **IF** there are environmental variables. **To Reproduce** Steps to reproduce the behavior: 1. Create a PowerShell script to dump all the environmental variables: `Get-ChildItem ENV:` 2. Do not check Run As User. 3. Add an environmental variable. 4. Run the script and save the output. Pay attention to the `USERNAME`, `USERPROFILE`, and other user specific variables. 5. Check Run As User. 6. Run the script and save the output. Pay attention to the `USERNAME`, `USERPROFILE`, and other user specific variables. 7. Notice the user specific variables did not change. 8. Leave Run As User checked and remove the environmental variable. 9. Run the script and save the output. Pay attention to the `USERNAME`, `USERPROFILE`, and other user specific variables. 10. Notice the user specific variables now reflect the logged in user. **Expected behavior** I expected the environmental variables to reflect the logged in user when Run As User is checked. **Screenshots** N/A **Additional context** N/A
kerem 2026-03-02 02:20:34 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@wh1te909 commented on GitHub (Aug 24, 2023):

fix will be in agent 2.4.12 in next release

<!-- gh-comment-id:1692297609 --> @wh1te909 commented on GitHub (Aug 24, 2023): fix will be in agent 2.4.12 in next release
Author
Owner

@wh1te909 commented on GitHub (Sep 2, 2023):

released in 0.16.4

<!-- gh-comment-id:1703611956 --> @wh1te909 commented on GitHub (Sep 2, 2023): released in 0.16.4
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#1010
No description provided.