问题
when i executed the following query i am not getting the Name of the process only getting the thread details.
Get-Process -ProcessName Test | Select-Object @{Label='CMPNAME';Expression={$_.Name}} -ExpandProperty Threads | Select-Object {$_.Id}
OUTPUT :
$_.Id
-----
8412
10460
10484
10508
10520
10524
回答1:
You need to tell Select-Object
which properties to select:
Get-Process -ProcessName Test | Select-Object @{Label='CMPNAME';Expression={$_.Name}} -ExpandProperty Threads | Select-Object CMPNAME,Id
来源:https://stackoverflow.com/questions/65920638/how-to-use-select-object-to-get-details-of-process-and-thread-in-single-query