How to do it...

Let us begin with listing out the processes; we shall look at all the properties the Get-Process cmdlet gives us and look for complex ones.

  1. Select all the properties that are part of the output of the Get-Process cmdlet. Pick only the first object, so your console is not filled with content.
PS> Get-Process | Select-Object -Property * -First 1

Observe the property, Threads.

  1. Select the name of the process, the ID and the threads.
PS> Get-Process | Select-Object -Property Name, Id, Threads
  1. List out all the threads for the pwsh process.
PS> Get-Process pwsh | Select-Object -ExpandProperty Threads
  1. A lot of content is output. Say, we want just the ID, the priority, and the start time of the resulting output.
PS> Get-Process pwsh | Select-Object -ExpandProperty Threads | Select-Object -Property Id, PriorityLevel, StartTime

This gave us the ID, the priority level and the start time of all the threads that are running under pwsh.

  1. What if we use ExpandProperty on the ID?
PS> Get-Process pwsh | Select-Object -ExpandProperty Threads | Select-Object -ExpandProperty Id
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.186.201