# Retrieving the currently logged in OS username from a Perspective session?

**URL:** <https://forum.inductiveautomation.com/t/retrieving-the-currently-logged-in-os-username-from-a-perspective-session/58199>\
**Category:** Ignition\
**Created:** [April 8, 2022, 12:07am UTC](https://forum.inductiveautomation.com/t/retrieving-the-currently-logged-in-os-username-from-a-perspective-session/58199 "2022-04-08T00:07:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [April 8, 2022, 12:07am UTC](https://forum.inductiveautomation.com/t/retrieving-the-currently-logged-in-os-username-from-a-perspective-session/58199/1 "2022-04-08T00:07:17Z")

</div>

I realise that via a browser this most likely is in breach of all kinds of security protocols and hence impossible, but what about from Perspective Workstation - is this possible now (or could it be in the future)?

In Vision Java I used to use:

```auto
from java.lang import System
System.getenv('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:** [April 8, 2022, 12:08am UTC](https://forum.inductiveautomation.com/t/retrieving-the-currently-logged-in-os-username-from-a-perspective-session/58199/2 "2022-04-08T00:08:44Z")

</div>

> [@nminchin](#):
>
> is this possible now

no

> [@nminchin](#):
>
> (or could it be in the future)?

could be... I think it's technically possible if you could execute code that executed in the workstation app instead of on the gateway.

---

<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:** [April 8, 2022, 12:10am UTC](https://forum.inductiveautomation.com/t/retrieving-the-currently-logged-in-os-username-from-a-perspective-session/58199/3 "2022-04-08T00:10:13Z")

</div>

> [@nminchin](#):
>
> In Vision Java I used to use:
> 
> ```auto
> from java.lang import System
> System.getenv('USERNAME')
> 
> ```

also:

```auto
System.getProperty("user.name");

```

doesn't depend on an environment variable.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [April 8, 2022, 12:12am UTC](https://forum.inductiveautomation.com/t/retrieving-the-currently-logged-in-os-username-from-a-perspective-session/58199/4 "2022-04-08T00:12:35Z")

</div>

> [@Kevin.Herron](#):
>
> if you could execute code that executed in the workstation app instead of on the gateway.

The reason I ask is that a customer is wanting to "permanently" keep users logged in that log into Perspective with the same username as they log into Windows with. We do this for Vision currently and they would like the same for Perspective.  
Otherwise, we log them out after a period of time.

---

<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:** [April 8, 2022, 12:14am UTC](https://forum.inductiveautomation.com/t/retrieving-the-currently-logged-in-os-username-from-a-perspective-session/58199/5 "2022-04-08T00:14:52Z")

</div>

Hmm. I’m not sure if that’s possible at the moment. Workstation is mostly untapped potential right now.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [April 8, 2022, 12:15am UTC](https://forum.inductiveautomation.com/t/retrieving-the-currently-logged-in-os-username-from-a-perspective-session/58199/6 "2022-04-08T00:15:26Z")

</div>

No worries, I might add an idea request for it. Cheers for the reply!

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [April 8, 2022, 12:18am UTC](https://forum.inductiveautomation.com/t/retrieving-the-currently-logged-in-os-username-from-a-perspective-session/58199/7 "2022-04-08T00:18:55Z")

</div>

What about an AD user source? I have one setup that uses an AD user source, and when you log into perspective the user name is available through session properties. That assumes they log into their machines with the domain credentials as well though.
