You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tools like Process Explorer show you a Tree like view for processes that allow you to visibly see a parent's process
I feel it makes sense to add -Parent and for this to run up the tree of parent processes & return information on all parent processes
We already expose Parent as a CodeProperty on the System.Diagnostics.Process type that we could use when returning a single parent process
We could extend this so that it recursively returns or add a similar Parents Code method that does this - but only if there are multiple parents & be blank if there aren't more than one.
This is doable already today but is messy & requires upfront knowledge of how many layers deep this process is.
This should be contained a new Parent ParameterSet that when called will return info for Parent Processes of 1/more Processes but should require ID or Name or Current parameters (if Add -Current Parameter to Get-Process #27028 is added) as not to try and get all parent processes for all processes for performance reasons (unless deemed useful to do so)
Initial implementation should return just like how it is today for multiple processes, returning in sequence of grouping together the parent processes with the one being queried at that time for context reasoning
An ideal implementation would allow for this to be displayed in a tree view like those tools but would be a stretch goal & as such I would expect this to come much later on unless it would be simple to add
Or a longer version without the fancy assignment tricks that can be difficult to understand:
$Process = Get-Process -Id $PID
do
{
$Process
$Process = $Process.Parent
}
while ($null -ne $Process)
As for the feature suggestion itself, I don't see much use for it myself but it wouldn't bother me if it was added. However, if it were to be added I think it should be named something like "ParentTree" or something, because "Parent" to me would imply just 1 layer.
If there a cost overhead getting all the parents on Windows? Historically Windows has no concept of parent process and it is typically found using WMIC rather than a kernel API. On POSIX systems only the parent can wait for a child process to finish, on Windows any process that can get a handle for the process with the appropriate rights can wait. I can see this being done on Linux using the /proc file system but not how it would be done on MacOS or FreeBSD without having to run the 'ps' program.
I'm not overly clear on the use case(s) for this proposed feature, but it seems a good idea.
If there is no parent, or if the process itself IS the parent, would -parent , return a new error? And is that error a terminating or non-terminating error?
Does -parent return the direct parent or the root of the process tree? I suspect it means the direct parent. Given this, is there a need for a -root to get the root of this process's process tree?
Activity
MartinGC94 commentedon Mar 14, 2026
You don't need to know the layers if you just use a loop:
Or a longer version without the fancy assignment tricks that can be difficult to understand:
As for the feature suggestion itself, I don't see much use for it myself but it wouldn't bother me if it was added. However, if it were to be added I think it should be named something like "ParentTree" or something, because "Parent" to me would imply just 1 layer.
[-]Add -Parent Parameter to Get-Process[/-][+]Add -Parent Parameter to Get/Stop Process cmdlets[/+][-]Add -Parent Parameter to Get/Stop Process cmdlets[/-][+]Add -Parent Parameter to Get-Process [/+]rhubarb-geek-nz commentedon Mar 15, 2026
If there a cost overhead getting all the parents on Windows? Historically Windows has no concept of parent process and it is typically found using WMIC rather than a kernel API. On POSIX systems only the parent can wait for a child process to finish, on Windows any process that can get a handle for the process with the appropriate rights can wait. I can see this being done on Linux using the /proc file system but not how it would be done on MacOS or FreeBSD without having to run the 'ps' program.
kilasuit commentedon Mar 17, 2026
From a search for the CodeMethod that Parent calls (GetParentProcess) I found this in the 6.0 Change log
So should be reasonably fine in adding this.
doctordns commentedon Apr 17, 2026
I'm not overly clear on the use case(s) for this proposed feature, but it seems a good idea.
If there is no parent, or if the process itself IS the parent, would
-parent, return a new error? And is that error a terminating or non-terminating error?Does
-parentreturn the direct parent or the root of the process tree? I suspect it means the direct parent. Given this, is there a need for a-rootto get the root of this process's process tree?