Need current logged in user via relevance code

I am using below relevance code and want to know to the current windows session logged user name but it is giving me output of the all users logged in currently into the system.

Q:if exists true whose (if true then exists logged on user else false) then names of logged on users else if exists current user then name of current user else "<none>"
A: user1
A: Administrator
T: 1.764 ms

I’d recommend reading up on developer.bigfix.com/relevance for a reference on what exactly these inspectors are returning:
logged on user
current user

What do you mean when you say that you want to return only the “current windows session logged user name”?

Thanks for your reply,

Yes, I want to see the current log on user , but issue it that if there are 2 users logged on into desktop and one is in disconnected mode which I assume then below query wont display the photo of the current user even though I am getting single user name in q&n

i will take a look on the link which you have provided.

q: (name of it) of logged on users whose (active of it = True)
A: vj
T: 1.018 ms

thank you

I would recommend using only current user in that case. Read up on the difference between logged on user and current user and I’d wager you’ll come to the same conclusion.

I also seem to recall advising you in your other thread that you would encounter issues with multiple logged on users :slight_smile:

1 Like

Yes, i remembered that what you said :slight_smile: , when i use the below query it throws error along with string object as you can see the difference below
any suggestion on this?

q:"C:\Users\" & (name of it) of logged on users whose (active of it = True) & "\AppData\Local\Microsoft\Office\16.0\Lync\sip_vj@vijay.local\Photo\sip_vj@vijay.local.cache"
E: A singular expression is required.

q:(name of it) of logged on users whose (active of it = True)
A: vj
T: 1.028 ms

I really can’t recommend using the fixlet debugger with type information enabled enough:
image

Q: (name of it) of logged on users whose (active of it = True)
A: **redacted**
T: 3.022 ms
I: plural string

Notice how the answer is a plural string? As I pointed out in the other thread, you can’t input a plural answer into a singular string.

Q: (name of logged on user whose (active of it = True))
A: **redacted**
T: 1.604 ms
I: singular string
2 Likes

It works , thanks for your awesome reply.

1 Like