Lerch Web Wiki

Random, erratic, no responsibility is taken for the correctness of this information

User Tools

Site Tools


Working with Media Files

$files = gci .\Music -Include *.mp3,*.wma -Force -Recurse -ErrorAction SilentlyContinue
$wmp = New-Object -com wmplayer.ocx
$metaData = @()
foreach ($file in $files)
       $media = $wmp.newMedia($file.FullName)
       $hash = @{}
       0..($media.attributeCount - 1) | ? { $media.getItemInfo($media.getAttributeName($_)) } | 
         % { $hash[$media.getAttributeName($_)] = $media.getItemInfo($media.getAttributeName($_)) }
       $metaData += [PSCustomObject]$hash
$metaData | Export-Csv -Path "$($pwd.Path)\metaData.csv" -NoTypeInformation
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
powershell/basics/media.txt · Last modified: 2020/03/24 09:01 (external edit)