none
Issue with Get-ChildItem RRS feed

  • Pregunta

  • Hi!

    I want to do some file listing stuff but I ran into an issue.

    With  Get-ChildItem e: | where {$_.length} | fl    I get

    Name           : msdia80.dll
    Length         : 904704
    CreationTime   : 12/1/2006 10:37:14 PM
    LastWriteTime  : 12/1/2006 10:37:14 PM
    LastAccessTime : 3/28/2017 3:51:38 PM
    VersionInfo    : File:             E:\msdia80.dll
                     InternalName:     MSDIA80.DLL
                     OriginalFilename: MSDIA80.DLL
                     FileVersion:      8.00.50727.762 (SP.050727-7600)
                     FileDescription:  Microsoftr Debug Information Accessor
                     Product:          Microsoftr Visual Studior 2005
                     ProductVersion:   8.00.50727.762
                     Debug:            False
                     Patched:          False
                     PreRelease:       False
                     PrivateBuild:     False
                     SpecialBuild:     False
                     Language:         English (United States)

    (I use the Where to get only files...old server PS)

    Now I want to list VersioInfo details. I doing that with

    Get-ChildItem e: | where {$_.length} | select @{ Label = 'FileVersionInfo'; Expression = { $_.VersionInfo.XXX }}

    Now the XXX ist the problem. I get the result for language, InternalName, Productversion.... BUT NOT for File.

    PS C:\temp> Get-ChildItem e: | where {$_.length} | select @{ Label = 'FileVersionInfo'; Expression = { $_.VersionInfo.La
    nguage }},length, *time


    FileVersionInfo : English (United States)
    Length          : 904704
    CreationTime    : 12/1/2006 10:37:14 PM
    LastAccessTime  : 3/28/2017 3:51:38 PM
    LastWriteTime   : 12/1/2006 10:37:14 PM

    PS C:\temp> Get-ChildItem e: | where {$_.length} | select @{ Label = 'FileVersionInfo'; Expression = { $_.VersionInfo.Fi
    le }},length, *time


    FileVersionInfo :
    Length          : 904704
    CreationTime    : 12/1/2006 10:37:14 PM
    LastAccessTime  : 3/28/2017 3:51:38 PM
    LastWriteTime   : 12/1/2006 10:37:14 PM

    What am I missing here? Why is it empty? THX

    viernes, 17 de enero de 2020 11:24

Todas las respuestas

  • Try FileName.

    yaro

    viernes, 17 de enero de 2020 12:11
  • This seemed to do it for me.

    $DesiredPath = <your path here>

    Get-ChildItem $DesiredPath |where{$_.Length} | fl @{label='FileVersionInfo';Expression={$_.VersionInfo}},length,*time

    viernes, 17 de enero de 2020 13:59
  • Not sure what the above's doing better for you than your previous statement other than throwing all the VersionInfo properties. Test 
    (Get-ChildItem).VersionInfo | Get-Member
    to see the property names 
    and then try
    (Get-ChildItem).VersionInfo.FileName

    this should give you an idea what you need in your expression statement. 

    yaro

    viernes, 17 de enero de 2020 20:02