get list of IDs of all active user sessions

Hello, Are there any way to get IDs of all active user sessions in system? If I understand correctly, SessionGetInfo() returns only caller's session info but what about other sessions? Are there any way to get list of all currently active sessions (I need sessionID, not userId) in daemon?

Thank you in advance!

Answered by DTS Engineer in 788592022

Why do you need that?

My experience is that most folks who ask this question are heading down the wrong path. For example, they might be building a daemon and trying to reach ‘up’ from their daemon into a user session. That’s at odds with macOS’s overall architecture; things work better when all the dependencies point ‘down’.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

Why do you need that?

My experience is that most folks who ask this question are heading down the wrong path. For example, they might be building a daemon and trying to reach ‘up’ from their daemon into a user session. That’s at odds with macOS’s overall architecture; things work better when all the dependencies point ‘down’.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thank you for confirmation that this is impossible.

this is impossible.

That’s not what I said. Rather, I asked why you’re trying to do this, because there are reasonable paths forward here, they just don’t involve an API that returns a list of login sessions.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

get list of IDs of all active user sessions
 
 
Q