Every Win32_Process object contains a SessionId field. What is the simplest way to get the current Windows session ID in PowerShell? By current I mean the session in which the script is running. I'd like to avoid parsing the output of the query session
command. If that's not achievable, is it possible to list all processes in the current session?
Asked
Active
Viewed 3.2k times
10

s4nk
- 647
- 1
- 9
- 18
-
I would also be curious but if you get stuck you can use my answer [here](http://stackoverflow.com/a/29130697/3829407) to parse the data from `qwinsta` into a PowerShell object. – Matt May 07 '15 at 13:43