none
Using Pipes to obtain file versions from Get-Process RRS feed

  • Question

  • Hi

    I'm trying to learn more about pipes and getting a bit stuck.

    I need a small simple command that will display all the processes running together with their file versions.

    This is what I've done so far if anyone can help to build it from here please.

    Get-Process -Module explorer | Select Filename # Don't know how to continue

    pipe commands using (Get-Item $filepathname).VersionInfo.FileVersion

    to obtain the file version


    Kind Regards

    Matt

    Monday, May 12, 2014 2:42 PM

Answers

  • Hi Matt,

    try this:
    Get-Process -Module explorer | Select Name, FileVersion

    Cheers,
    Fred


    There's no place like 127.0.0.1

    • Marked as answer by jmatty2000 Monday, May 12, 2014 2:58 PM
    Monday, May 12, 2014 2:56 PM
  • Hi Matt,

    Here's one method, using ForEach-Object to return information on each item:

    Get-Process -Module explorer | ForEach {
    
        $props = @{
            FileName = $_.FileName
            FileVersion = $_.FileVersion
        }
    
        New-Object PsObject -Property $props
    
    }


    Don't retire TechNet! - (Don't give up yet - 12,830+ strong and growing)

    • Marked as answer by jmatty2000 Monday, May 12, 2014 3:01 PM
    Monday, May 12, 2014 2:52 PM
  • Easiest method and fastest:

    Get-Process -Module explorer |select -expand FIleVersionInfo

    This has everything you need and it is in the pipe.


    ¯\_(ツ)_/¯

    • Marked as answer by jmatty2000 Monday, May 12, 2014 3:32 PM
    Monday, May 12, 2014 3:16 PM
  • Hi

    I've now come up with my own little solution - lol

    Get-Process -Module Explorer | Format-Table Filename,FileVersion

    Thanks for your help and very fast also - I won't even think about joining any other Forums now.

    Cheers

    Matt


    • Marked as answer by jmatty2000 Monday, May 12, 2014 3:38 PM
    • Edited by jmatty2000 Monday, May 12, 2014 3:39 PM
    Monday, May 12, 2014 3:37 PM
  • Choose the columns you want.  They are not duplicates. One is File Version and the other is the product version - they are not the same thing.

    Get-Process -Module explorer |
          select -expand FIleVersionInfo |
     
          Select FileVersion,
      FileName                                                                                           


    ¯\_(ツ)_/¯


    • Edited by jrv Monday, May 12, 2014 3:38 PM
    • Marked as answer by jmatty2000 Monday, May 12, 2014 3:40 PM
    Monday, May 12, 2014 3:38 PM

All replies

  • Hi Matt,

    Here's one method, using ForEach-Object to return information on each item:

    Get-Process -Module explorer | ForEach {
    
        $props = @{
            FileName = $_.FileName
            FileVersion = $_.FileVersion
        }
    
        New-Object PsObject -Property $props
    
    }


    Don't retire TechNet! - (Don't give up yet - 12,830+ strong and growing)

    • Marked as answer by jmatty2000 Monday, May 12, 2014 3:01 PM
    Monday, May 12, 2014 2:52 PM
  • Hi Matt,

    try this:
    Get-Process -Module explorer | Select Name, FileVersion

    Cheers,
    Fred


    There's no place like 127.0.0.1

    • Marked as answer by jmatty2000 Monday, May 12, 2014 2:58 PM
    Monday, May 12, 2014 2:56 PM
  • Hi Mike

    Thats Brill. Is there any more simple solutions that you can think of - I've not learned about PowerShell Objects as yet so could do with avoiding that side of things for now please.

    Cheers

    Matt

    Monday, May 12, 2014 2:56 PM
  • Top marks to you Fred - this is ultra easy to follow.

    Cheers

    Matt

    Monday, May 12, 2014 2:58 PM
  • Hi Mike

    Thats Brill. Is there any more simple solutions that you can think of - I've not learned about PowerShell Objects as yet so could do with avoiding that side of things for now please.

    Cheers

    Matt

    You'll need to learn eventually. =]

    Fred's on the mark, I always default to using a loop even when I don't need to.

    One note though, use FileName,FileVersion in the select statement.


    Don't retire TechNet! - (Don't give up yet - 12,830+ strong and growing)

    Monday, May 12, 2014 3:00 PM
  • Easiest method and fastest:

    Get-Process -Module explorer |select -expand FIleVersionInfo

    This has everything you need and it is in the pipe.


    ¯\_(ツ)_/¯

    • Marked as answer by jmatty2000 Monday, May 12, 2014 3:32 PM
    Monday, May 12, 2014 3:16 PM
  • Thanks jrv. The output from your commands gives out duplicate columns though:-

    ProductVersion FileVersion FileName -------------- ----------- -------- 6.1.7600.16385 6.1.7600.1638... C:\Windows\System32\wship6.dll 6.1.7600.16385 6.1.7600.1638... C:\Windows\System32\fwpuclnt.dll 9.00.8112.16545 9.00.8112.165... C:\Windows\system32\jsproxy.dll 5.8.7601.16978 5.8.7601.16978 C:\Windows\System32\jscript.dll 6.1.7600.16385 6.1.7600.1638... C:\Windows\system32\twext.dll 9.20 9.20 C:\Program Files\7-Zip\7-zip.dll 6.1.7600.16385 6.1.7600.1638... C:\Windows\system32\thumbcache.dll 6.1.7601.17514 6.1.7601.1751... C:\Windows\System32\NaturalLanguage6.dll 6.1.7600.16385 6.1.7600.1638... C:\Windows\System32\NLSData0009.dll 6.1.7600.16385 6.1.7600.1638... C:\Windows\System32\NLSLexicons0009.dll

    Monday, May 12, 2014 3:31 PM
  • Hi

    I've now come up with my own little solution - lol

    Get-Process -Module Explorer | Format-Table Filename,FileVersion

    Thanks for your help and very fast also - I won't even think about joining any other Forums now.

    Cheers

    Matt


    • Marked as answer by jmatty2000 Monday, May 12, 2014 3:38 PM
    • Edited by jmatty2000 Monday, May 12, 2014 3:39 PM
    Monday, May 12, 2014 3:37 PM
  • Choose the columns you want.  They are not duplicates. One is File Version and the other is the product version - they are not the same thing.

    Get-Process -Module explorer |
          select -expand FIleVersionInfo |
     
          Select FileVersion,
      FileName                                                                                           


    ¯\_(ツ)_/¯


    • Edited by jrv Monday, May 12, 2014 3:38 PM
    • Marked as answer by jmatty2000 Monday, May 12, 2014 3:40 PM
    Monday, May 12, 2014 3:38 PM