How to use Select-object to get details of process and thread in single query?

隐身守侯 提交于 2021-01-29 15:37:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!