11

I'm trying to retrieve some extended file attributes (mp3 files to be precise) listed in the "Details" tab, section "Media" with PowerShell.

There are additional attributes like bitrate, genre, album, etc.

Sadly Get-ItemProperty -Path $pathtofile | Format-List does not return those.

Get-ItemProperty -Path $pathtofile | Get-Member does not list them either.

Strange enough, Get-ItemProperty returns the same output as Get-ChildItem.
I've tried different files (even non mp3s) and PowerShell does not list the "detail" attributes anywhere.

Where does windows store these? Also how can one list them?

Clijsters
  • 4,031
  • 1
  • 27
  • 37
ShellOfPower
  • 113
  • 1
  • 1
  • 4
  • 2
    I'm not aware of a native `PowerShell`/`.NET` way. Check out [TagLib#](https://github.com/mono/taglib-sharp/) and [this related StackOverflow post](https://stackoverflow.com/questions/5990881/reading-id3v2-frames-with-taglib-in-powershell) – G42 Mar 10 '18 at 23:30
  • Does adding -Property * -Force give you what you want? – Owain Esau Mar 11 '18 at 01:27
  • I'm not sure, but think this one's duplicated. Check out https://stackoverflow.com/questions/30104977/powershell-editing-mp3-infos – Clijsters Mar 11 '18 at 10:52
  • @OwainEsau sadly those cmdlets dont have the `-properties *` parameter. Seems like TagLib# is the way to go for retrieving the attributes listed in details. Thanks a lot guys! – ShellOfPower Mar 11 '18 at 15:51
  • did u figure out how to do it? im looking to find similar info for font files. – oldboy Jan 22 '20 at 06:47

3 Answers3

2

Update 3; I found a better script that should do exactly what you want provided by the incredible "Hey! Scripting Guy" blog. They already built a function that lets you view all of the details of music/mp3 files.

Blog post
https://blogs.technet.microsoft.com/heyscriptingguy/2014/02/05/list-music-file-metadata-in-a-csv-and-open-in-excel-with-powershell/

Function
https://gallery.technet.microsoft.com/scriptcenter/get-file-meta-data-function-f9e8d804

Nick W.
  • 1,536
  • 3
  • 24
  • 40
  • 3
    The function "Get-File-Meta-Data" seems not to be available anymore. Are there any other sources? – PeterCo Nov 07 '21 at 11:13
  • 2
    @PeterCo I googled: --> PowerShell "Get-FileMetaData" <-- and got this: https://www.powershellgallery.com/packages/FC_SysAdmin/5.0.0/Content/public%5CGet-FileMetaData.ps1 Microsoft broke everything when they retired technet. – Naptha Aug 04 '22 at 16:45
2

I had a look at Ed Wilson's post. I can see he wrote it back in the day on Windows Vista. Powershell has changed a bit since then. I've tweaked the code he had written to work on Win 10. Hope this helps!

 # Converted from Ed Wilson: https://devblogs.microsoft.com/scripting/hey-scripting-guy-how-can-i-find-files-metadata/

param($folder = "C:\Test") #end param

function funLinestrIN($strIN)
{
     $strLine = "=" * $strIn.length
     Write-Host "`n$strIN" -ForegroundColor Yellow 
     Write-Host $strLine -ForegroundColor Cyan
} #end funline

function funMetaData
{
    foreach($sFolder in $folder)
         {
              $a = 0
              $objShell = New-Object -ComObject Shell.Application
              $objFolder = $objShell.namespace($sFolder)

              foreach ($strFileName in $objFolder.items())
                   { 
                       funLinestrIN( "$($strFileName.name)")
                       for ($a ; $a  -le 266; $a++)
                          { 
                                if($objFolder.getDetailsOf($strFileName, $a))
                                  {
                                        $hash += @{ `
                                              $($objFolder.getDetailsOf($objFolder.items, $a)) = $($objFolder.getDetailsOf($strFileName, $a)) 
                                              } #end hash
                                       $hash
                                       $hash.clear()
                                  } #end if
                            } #end for 
                        $a=0
                    } #end foreach
        } #end foreach
} #end funMetadata
funMetaData # run function
JefNet
  • 21
  • 1
1

This answer is just to fix the link in Nick W's answer. Microsoft killed TechNet but the script is on PowerShell Gallery.

I googled the following to find it: PowerShell "Get-FileMetaData"

The location is: https://www.powershellgallery.com/packages/FC_SysAdmin/5.0.0/Content/public%5CGet-FileMetaData.ps1

Unfortunately, I can't get it to work, lol.

Naptha
  • 121
  • 5