Jobs created in a PowerShell service display differently in Task Manager

Use this forum to ask questions after your subscription maintenance expires or before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
This topic is 4 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
mac_attack
Posts: 1
Last visit: Tue Mar 17, 2020 8:08 am

Jobs created in a PowerShell service display differently in Task Manager

Post by mac_attack »

Product: PowerShell Studio 2019 (64 Bit)
Build: v5.6.164
OS: Windows 10 Pro (64 Bit)
Build: v10.0.17763.0

This is a continuation of the following SO question: https://stackoverflow.com/questions/585 ... sk-manager

If I start multiple PowerShell jobs using the snippet below, the 'child' processes are grouped together under the invoking/parent process in Task Manager:

Code: Select all

Start-Job -SciptBlock {Start-Sleep 600}
Example showing jobs grouped nicely under 'parent' process:
Image

Yet if I create a number of jobs in a Service created using PowerShell Studio, the jobs created appear in Task Manager ungrouped, as though they're independant processes.

Example showing loose/ungrouped jobs created by PowerShell Service
Image

Does anyone know why this happens? It might just be because the job is being created by a background application/service and is expected Windows behaviour; rather than strange behaviour caused by PowerShell Studio! :)

Thanks,
Mac
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Jobs created in a PowerShell service display differently in Task Manager

Post by Alexander Riedel »

First of all, a process is always an independent entity. Since you are creating a new process using Start-Job, which is a Microsoft PowerShell CmdLet, you should probably ask there what exactly they do behind the scenes.
The most likely explanation is that if you start a job from a console, stdin, stdout and stderr of the new process share the same streams of the 'parent' process, hence it creates a dependence and relation.
If you start your jobs from a non-console process, like a service, there is no console and stdin, stdout and stderr mean nothing, so they are likely not shared (I did not verify this).
That in turn means that Task Manager has no means to correlate these processes and group them, because they do not share anything.
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 4 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.