# Get username inside Gateway Scheduled Script

**URL:** <https://forum.inductiveautomation.com/t/get-username-inside-gateway-scheduled-script/83281>\
**Category:** Ignition\
**Created:** [December 18, 2023, 7:50pm UTC](https://forum.inductiveautomation.com/t/get-username-inside-gateway-scheduled-script/83281 "2023-12-18T19:50:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![HelloWorld](https://avatars.discourse-cdn.com/v4/letter/h/b782af/32.png) [@HelloWorld](https://forum.inductiveautomation.com/u/HelloWorld)\
**Post date:** [December 18, 2023, 7:50pm UTC](https://forum.inductiveautomation.com/t/get-username-inside-gateway-scheduled-script/83281/1 "2023-12-18T19:50:22Z")

</div>

Is it possible to retrieve the username of who is logged in a Gateway scheduled script ?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 18, 2023, 7:51pm UTC](https://forum.inductiveautomation.com/t/get-username-inside-gateway-scheduled-script/83281/2 "2023-12-18T19:51:00Z")

</div>

Nobody is logged into a gateway scheduled script.

---

<div class="post-metadata">

**Author:** ![HelloWorld](https://avatars.discourse-cdn.com/v4/letter/h/b782af/32.png) [@HelloWorld](https://forum.inductiveautomation.com/u/HelloWorld)\
**Post date:** [December 18, 2023, 7:51pm UTC](https://forum.inductiveautomation.com/t/get-username-inside-gateway-scheduled-script/83281/3 "2023-12-18T19:51:52Z")

</div>

Ok that makes sense, let's say I run a project library script from the gateway scheduled script, can I retrieve that info from the project library script?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 18, 2023, 7:52pm UTC](https://forum.inductiveautomation.com/t/get-username-inside-gateway-scheduled-script/83281/4 "2023-12-18T19:52:49Z")

</div>

There is no user associated with a gateway scheduled script, regardless of whether you call into a project script or not.

Is this what you're asking, or are you asking if there's away to e.g. get a list of all the sessions that currently exist (which have a user associated with them)?

---

<div class="post-metadata">

**Author:** ![HelloWorld](https://avatars.discourse-cdn.com/v4/letter/h/b782af/32.png) [@HelloWorld](https://forum.inductiveautomation.com/u/HelloWorld)\
**Post date:** [December 18, 2023, 7:53pm UTC](https://forum.inductiveautomation.com/t/get-username-inside-gateway-scheduled-script/83281/5 "2023-12-18T19:53:59Z")

</div>

I guess I was asking both, now that I know that, is there a way to get a list of all the sessions, and know which session the script is being run off to get the associated username ?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 18, 2023, 7:54pm UTC](https://forum.inductiveautomation.com/t/get-username-inside-gateway-scheduled-script/83281/6 "2023-12-18T19:54:40Z")

</div>

you don't seem to understand, the script is not being run by _any_ session. It's part of the project, and runs on the gateway, and would continue to be run and scheduled even if no users were logged in.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 18, 2023, 7:55pm UTC](https://forum.inductiveautomation.com/t/get-username-inside-gateway-scheduled-script/83281/7 "2023-12-18T19:55:25Z")

</div>

You can get session info via:  
[https://docs.inductiveautomation.com/display/DOC81/system.util.getSessionInfo](https://docs.inductiveautomation.com/display/DOC81/system.util.getSessionInfo)  
[https://docs.inductiveautomation.com/display/DOC81/system.perspective.getSessionInfo](https://docs.inductiveautomation.com/display/DOC81/system.perspective.getSessionInfo)

but again, there is no session associated with a gateway scheduled script.

---

<div class="post-metadata">

**Author:** ![HelloWorld](https://avatars.discourse-cdn.com/v4/letter/h/b782af/32.png) [@HelloWorld](https://forum.inductiveautomation.com/u/HelloWorld)\
**Post date:** [December 18, 2023, 7:55pm UTC](https://forum.inductiveautomation.com/t/get-username-inside-gateway-scheduled-script/83281/8 "2023-12-18T19:55:49Z")

</div>

perfect - thank you
