Feature Request: add parameter -CurrentUser for Get-Process
See original GitHub issueHi
Sometimes I need to check if a process is running for the current user (non-admin on terminal server). Now I use get-process -Name "ProcessName" | ? { $_.SI -eq $([System.Diagnostics.Process]::GetCurrentProcess().SessionId) }
. But it would be much easier if I could use get-process -Name "ProcessName" -CurrentUser
.
Kind regards Frederik.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:9 (5 by maintainers)
Top Results From Across the Web
List process for current user - powershell
But as a non-administrator I can't use -IncludeUserName becuase "The 'IncludeUserName' parameter requires elevated user rights". So if I'm ...
Read more >about Functions - PowerShell
Function parameters can be read from the command line or from the pipeline. Functions can return values that can be displayed, assigned to ......
Read more >Start-Job - Module: Microsoft.PowerShell.Core
Specifies the definition name of the job that this cmdlet starts. Use this parameter to start custom job types that have a definition...
Read more >Designing Professional Parameters - powershell.one
Parameters are a way for the caller to submit information to code. They are a fundamental feature of PowerShell scriptblocks: a param() ...
Read more >Get process request
Table 1. URL parameters. Parameter, Type, Required, Description. requestId, string, true, Id of process request. Table 2. Header parameters ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What you propose sounds like sane behaviour to me.
That’s just what
Get-Process
states but it’s not the whole truth. Yes you need elevation to get the username of processes run by other users (or elevated ones of the current user) but it is still possible to get the token information for the majority of the processes run by the current user.The DACL of a standard/limited access token gives query/read access to the following accounts
and the following for an admin one
There are other complications when it comes to getting a copy of the process token (not the same as the access token) which stops you from getting the access token of elevated processes.
In addition to this, filtering by the session id means you will miss out on processes for that user that are run in a separate session (task scheduler, network logon/winrm, services).