Search code examples
powershellget-childitem

Powershell: Get-Childitem, is there a way to list comments?


I'm working with powershell but I'm kinda new to this So my problem is, I have a folder full of msi-packages. If I go properties -> Details, a description can be found in the comment section. Since I don't want to click everything, I would like to list them with powershell.

Here's a Picture of the value I need

So far I got this:

get-childitem c:\windows\installer\* -include *.msi

I can't find a solution and I'm grateful for any help.


Solution

  • This isn't my solution; I am just pasting it here from this link

    Here is some example code:

    http://powershell.com/cs/blogs/tobias/archive/2011/01/07/organizing-videos-and-music.aspx

    Say you had a video file: C:\video.wmv

    $path = 'C:\video.wmv'
    $shell = New-Object -COMObject Shell.Application
    $folder = Split-Path $path
    $file = Split-Path $path -Leaf
    $shellfolder = $shell.Namespace($folder)
    $shellfile = $shellfolder.ParseName($file)
    

    You'll need to know what the ID of the extended attribute is. This will show you all of the IDs:

    0..287 | Foreach-Object { '{0} = {1}' -f $_, $shellfolder.GetDetailsOf($null, $_) }
    

    Once you find the one you want you can access it like this:

    $shellfolder.GetDetailsOf($shellfile, 216)