locked
excluding one or some columns in output of Get-process cmdlet doesn't work RRS feed

  • Question

  • hello

    in PS 4.0 i need a command so that the output includes all columns except for, one or two columns ? 

    for example  get-process cmdlet shows seven columns. i need a cmdlet to show all columns except for handles & cpu columns.

    ( instead of running Get-process | select -object NPM,PM,WS,VM,CPU,ID )

    note: i tested the following command but it still shows handles & cpu columns in the output

    ( Get-process | select -excludeproperty  handles,cpu )

    thanks in advanced

    Friday, October 17, 2014 9:05 PM

Answers

  • Bill should have also pointed out that you can change the "Types" files to adjust output permanently.  I am sure that this would save you much typing.

    PowerShell is very flexible. We can select properties with wild cards...

    get-process|select s*,c* -first 3|ft -auto

    You can adjust this as needed.


    ¯\_(ツ)_/¯

    • Marked as answer by john.s2011 Saturday, October 18, 2014 7:40 AM
    Friday, October 17, 2014 11:18 PM
  • Bill should have also pointed out that you can change the "Types" files to adjust output permanently.  I am sure that this would save you much typing.

    PowerShell is very flexible. We can select properties with wild cards...

    get-process|select s*,c* -first 3|ft -auto

    You can adjust this as needed.


    ¯\_(ツ)_/¯

    hi jrv

    i didn't understand you first post at all:

     "have a better and more permanent solution.

    Print out put to very large wide E or F size plotter in landscape mode.... 

    Take scissors and cut out columns not needed.  Tape bits together.  NOw you have the results you like."

    but i undrestood your 2nd post, that nice. 

    thank you very much,

    i also found this workaround:

    Get-Process | Select-Object -Property * -ExcludeProperty cpu,handles | format-table -Autosize

    regards

    Hah! You found your solution.  My real point was that, with technology, it is research that gets you where you need to go.  Even cutting out paper dolls, although nonsensical, can make us think "outside-of-the box".

    Always start by reading all of the documentation until you completely understand it.  Do not rely on others to understand the documentation for you.


    ¯\_(ツ)_/¯


    • Edited by jrv Saturday, October 18, 2014 1:09 PM
    • Marked as answer by john.s2011 Monday, October 20, 2014 1:42 PM
    Saturday, October 18, 2014 1:09 PM

All replies

  • What's wrong with running the cmdlet and just selecting the properties you want?


    -- Bill Stewart [Bill_Stewart]

    Friday, October 17, 2014 9:41 PM
  • What's wrong with running the cmdlet and just selecting the properties you want?


    -- Bill Stewart [Bill_Stewart]

    WOW, that's obvious.

    when the output includes many columns & we don't need one of them, it's reasonable that instead of typing in the name of multiple properties, there be a method that we use for example wildcard & only exclude that specific unnecessary column.

    isn't it? 

    i wish powershell team haven't ignored this issue.


    • Edited by john.s2011 Friday, October 17, 2014 9:53 PM
    Friday, October 17, 2014 9:50 PM
  • AFAICT, there's not really an issue to ignore. The following blog entry may be helpful:

    http://blogs.msdn.com/b/powershell/archive/2006/04/30/how-powershell-formatting-and-outputting-really-works.aspx


    -- Bill Stewart [Bill_Stewart]

    • Proposed as answer by jrv Friday, October 17, 2014 11:15 PM
    Friday, October 17, 2014 10:10 PM
  • John,

    I would like to propose a work around - that would be exporting all information to Excel then hiding the columns that you do not want.

    Its a quick and nasty way of getting the information in the format you want, now.

    Get-Process | epcsv C:\temp\temp.csv -NoTypeInformation

    ty.
    AM.


    Adrian Mohamed

    Friday, October 17, 2014 10:27 PM
  • I have a better and more permanent solution.

    Print out put to very large wide E or F size plotter in landscape mode.... 

    Take scissors and cut out columns not needed.  Tape bits together.  NOw you have the results you like.

    We aim to please... please aim!


    ¯\_(ツ)_/¯

    Friday, October 17, 2014 11:14 PM
  • Bill should have also pointed out that you can change the "Types" files to adjust output permanently.  I am sure that this would save you much typing.

    PowerShell is very flexible. We can select properties with wild cards...

    get-process|select s*,c* -first 3|ft -auto

    You can adjust this as needed.


    ¯\_(ツ)_/¯

    • Marked as answer by john.s2011 Saturday, October 18, 2014 7:40 AM
    Friday, October 17, 2014 11:18 PM
  • John,

    I would like to propose a work around - that would be exporting all information to Excel then hiding the columns that you do not want.

    Its a quick and nasty way of getting the information in the format you want, now.

    Get-Process | epcsv C:\temp\temp.csv -NoTypeInformation

    ty.
    AM.


    Adrian Mohamed

    hi Adrian.

    thanks but i found easier solution:

    Get-Process | Select-Object -Property * -ExcludeProperty cpu,handles | format-table -Autosize

    Saturday, October 18, 2014 7:38 AM
  • Bill should have also pointed out that you can change the "Types" files to adjust output permanently.  I am sure that this would save you much typing.

    PowerShell is very flexible. We can select properties with wild cards...

    get-process|select s*,c* -first 3|ft -auto

    You can adjust this as needed.


    ¯\_(ツ)_/¯

    hi jrv

    i didn't understand you first post at all:

     "have a better and more permanent solution.

    Print out put to very large wide E or F size plotter in landscape mode.... 

    Take scissors and cut out columns not needed.  Tape bits together.  NOw you have the results you like."

    but i undrestood your 2nd post, that nice. 

    thank you very much,

    i also found this workaround:

    Get-Process | Select-Object -Property * -ExcludeProperty cpu,handles | format-table -Autosize

    regards

    Saturday, October 18, 2014 7:44 AM
  • Bill should have also pointed out that you can change the "Types" files to adjust output permanently.  I am sure that this would save you much typing.

    PowerShell is very flexible. We can select properties with wild cards...

    get-process|select s*,c* -first 3|ft -auto

    You can adjust this as needed.


    ¯\_(ツ)_/¯

    hi jrv

    i didn't understand you first post at all:

     "have a better and more permanent solution.

    Print out put to very large wide E or F size plotter in landscape mode.... 

    Take scissors and cut out columns not needed.  Tape bits together.  NOw you have the results you like."

    but i undrestood your 2nd post, that nice. 

    thank you very much,

    i also found this workaround:

    Get-Process | Select-Object -Property * -ExcludeProperty cpu,handles | format-table -Autosize

    regards

    Hah! You found your solution.  My real point was that, with technology, it is research that gets you where you need to go.  Even cutting out paper dolls, although nonsensical, can make us think "outside-of-the box".

    Always start by reading all of the documentation until you completely understand it.  Do not rely on others to understand the documentation for you.


    ¯\_(ツ)_/¯


    • Edited by jrv Saturday, October 18, 2014 1:09 PM
    • Marked as answer by john.s2011 Monday, October 20, 2014 1:42 PM
    Saturday, October 18, 2014 1:09 PM
  • I would point out that select-object returns PSCustomObjects, not the underlying object type (Process, in this case).


    -- Bill Stewart [Bill_Stewart]


    Saturday, October 18, 2014 3:57 PM
  • Bill should have also pointed out that you can change the "Types" files to adjust output permanently.  I am sure that this would save you much typing.

    PowerShell is very flexible. We can select properties with wild cards...

    get-process|select s*,c* -first 3|ft -auto

    You can adjust this as needed.


    ¯\_(ツ)_/¯

    hi jrv

    i didn't understand you first post at all:

     "have a better and more permanent solution.

    Print out put to very large wide E or F size plotter in landscape mode.... 

    Take scissors and cut out columns not needed.  Tape bits together.  NOw you have the results you like."

    but i undrestood your 2nd post, that nice. 

    thank you very much,

    i also found this workaround:

    Get-Process | Select-Object -Property * -ExcludeProperty cpu,handles | format-table -Autosize

    regards

    Hah! You found your solution.  My real point was that, with technology, it is research that gets you where you need to go.  Even cutting out paper dolls, although nonsensical, can make us think "outside-of-the box".

    Always start by reading all of the documentation until you completely understand it.  Do not rely on others to understand the documentation for you.


    ¯\_(ツ)_/¯


    thank you jrv.

    unfortunately i am not very expert in English so i didn't understand the meaning of these section:

     Even cutting out paper dolls, although nonsensical, can make us think "outside-of-the box".

    thanks a lot anyway

     


    • Edited by john.s2011 Monday, October 20, 2014 1:46 PM
    Monday, October 20, 2014 1:45 PM
  • Monday, October 20, 2014 3:56 PM
  • Definition of terms: http://www.lifehack.org/articles/productivity/11-ways-to-think-outside-the-box.html


    ¯\_(ツ)_/¯

    cool, you have a link for every thing, that's Great   ;-)

    regards

    Monday, October 20, 2014 8:12 PM