[GH-ISSUE #580] agent.logged_in_user variable not working #2314

Closed
opened 2026-03-14 03:32:55 +03:00 by kerem · 5 comments
Owner

Originally created by @eric-robbins on GitHub (Jun 16, 2021).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/580

Server Info (please complete the following information):

  • OS: Ubuntu 20.04
  • Browser: chrome, FireFox
  • RMM Version (as shown in top left of web UI): v0.6.15

Installation Method:

  • Standard

Agent Info (please complete the following information):

  • Agent version (as shown in the 'Summary' tab of the agent from web UI): v1.5.8
  • Agent OS: Win 10

Describe the bug
The agent.logged_in_user variable doesn't work.

To Reproduce
Steps to reproduce the behavior:

  1. Create a script with argument -logged_in_user {{agent.logged_in_user}}.
  2. Add content of:
    Param (
    [string]$logged_in_user
    )
    Write-Host "The logged in user is: $logged_in_user"
  3. Output is:
    The logged in user is: {agent.logged_in_user}

Expected behavior
Should get output of:
The logged in user is: someUserName

Screenshot
image

Additional context
I have tested with all other agent variables as listed at https://wh1te909.github.io/tacticalrmm/script_variables.html. All other variables work except {{agent.logged_in_user}}. I have made sure to go back and use a copy past method with the agent variable to assure that there is no typo etc.

Originally created by @eric-robbins on GitHub (Jun 16, 2021). Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/580 **Server Info (please complete the following information):** - OS: Ubuntu 20.04 - Browser: chrome, FireFox - RMM Version (as shown in top left of web UI): v0.6.15 **Installation Method:** - [x] Standard **Agent Info (please complete the following information):** - Agent version (as shown in the 'Summary' tab of the agent from web UI): v1.5.8 - Agent OS: Win 10 **Describe the bug** The agent.logged_in_user variable doesn't work. **To Reproduce** Steps to reproduce the behavior: 1. Create a script with argument -logged_in_user {{agent.logged_in_user}}. 2. Add content of: Param ( [string]$logged_in_user ) Write-Host "The logged in user is: $logged_in_user" 3. Output is: The logged in user is: {agent.logged_in_user} **Expected behavior** Should get output of: The logged in user is: someUserName **Screenshot** ![image](https://user-images.githubusercontent.com/39501983/122252613-1c946880-ce91-11eb-8162-dbcc7010e986.png) **Additional context** I have tested with all other agent variables as listed at https://wh1te909.github.io/tacticalrmm/script_variables.html. All other variables work except {{agent.logged_in_user}}. I have made sure to go back and use a copy past method with the agent variable to assure that there is no typo etc.
kerem closed this issue 2026-03-14 03:33:00 +03:00
Author
Owner

@wh1te909 commented on GitHub (Jun 16, 2021):

Hi, thanks this is actually a typo in the docs. should be {{agent.logged_in_username}} just pushed an update to the docs
not all the variables are documented, you can always check the models.py file in each django app to get the full list of available vars (assuming they're not like json fields) github.com/wh1te909/tacticalrmm@99f2772bb3/api/tacticalrmm/agents/models.py (L46)

<!-- gh-comment-id:862544281 --> @wh1te909 commented on GitHub (Jun 16, 2021): Hi, thanks this is actually a typo in the docs. should be `{{agent.logged_in_username}}` just pushed an update to the docs not all the variables are documented, you can always check the `models.py` file in each django app to get the full list of available vars (assuming they're not like json fields) https://github.com/wh1te909/tacticalrmm/blob/99f2772bb39ecb87c52046668cfe7bc16d079e80/api/tacticalrmm/agents/models.py#L46
Author
Owner

@silversword411 commented on GitHub (Jun 16, 2021):

@wh1te909 Adding my todo list to update all the items in models.py to the docs. Should I skip the #Deprecated ones?

<!-- gh-comment-id:862599127 --> @silversword411 commented on GitHub (Jun 16, 2021): @wh1te909 Adding my todo list to update all the items in models.py to the docs. Should I skip the #Deprecated ones?
Author
Owner

@wh1te909 commented on GitHub (Jun 16, 2021):

@silversword411 awesome ty, yea skip the deprecated ones and also skip any of the models.JSONField since those won't render properly as strings

<!-- gh-comment-id:862602445 --> @wh1te909 commented on GitHub (Jun 16, 2021): @silversword411 awesome ty, yea skip the deprecated ones and also skip any of the `models.JSONField` since those won't render properly as strings
Author
Owner

@silversword411 commented on GitHub (Jun 16, 2021):

....also, if I re-arrange all those items (under class Agent(BaseAuditModel):) into alphabetic order it's not going to break anything is it? eg

operating_system = models.CharField(null=True, blank=True, max_length=255)
salt_ver = models.CharField(default="1.0.3", max_length=255)
version = models.CharField(default="0.1.0", max_length=255)
<!-- gh-comment-id:862602831 --> @silversword411 commented on GitHub (Jun 16, 2021): ....also, if I re-arrange all those items (under `class Agent(BaseAuditModel):`) into alphabetic order it's not going to break anything is it? eg ``` operating_system = models.CharField(null=True, blank=True, max_length=255) salt_ver = models.CharField(default="1.0.3", max_length=255) version = models.CharField(default="0.1.0", max_length=255) ```
Author
Owner

@wh1te909 commented on GitHub (Jun 16, 2021):

best to leave it as is, cuz changing stuff in the models will trigger a database migration which should only happen if we add or delete new db fields

<!-- gh-comment-id:862605408 --> @wh1te909 commented on GitHub (Jun 16, 2021): best to leave it as is, cuz changing stuff in the models will trigger a database migration which should only happen if we add or delete new db fields
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#2314
No description provided.