I'm pretty new working with Powershell and i have some working code but I'm not sure how to get it into an efficient routine to return all of the extended file properties of some video files i have.
I have:
# The basic setup for the next steps
$path = 'C:\test\videotocheck.mp4'
$shell = New-Object -COMObject Shell.Application
$folder = Split-Path $path
$file = Split-Path $path -Leaf
$shellfolder = $shell.Namespace($folder)
$shellfile = $shellfolder.ParseName($file)
# This command gets a list of all the extended attributes available for this file
0..500 | Foreach-Object { '{0} = {1}' -f $_, $shellfolder.GetDetailsOf($null, $_) }
# These commands get the individual attributes picked out of the list above
$shellfolder.GetDetailsOf($shellfile, 314)
$shellfolder.GetDetailsOf($shellfile, 316)
All i want to do is provide a filename and have it give me a list back of all of the attributes and their values (if they have one.)
I intend to use this in a SQL stored procedure. I can work with different types of output if that's easier.
I'm mostly interested in dimensions
Any guidance would be appreciated.

To get all of this extended metadate you could use the function below. You can give it the path to a single file, or the path to a folder where the files are.
You can of course play around with the different parameters the function can take like
-Pattern '*.mp4'to only list properties for mp4 files or add switch-IncludeEmptyPropertiesto also list properties that exist for that file type, but have no value for the specified file.With parameter
Propertiesyou can give the function an array of int32 values of the property indices to return. If you leave that open, the function tries to get all properties from index 1 to index 500 (if available).Most of the interesting property indices can be found at:
0,1,2,3,4,5,9,11,12,13,14,15,16,17,18,19,20,21,22,26,27,28,36,164,165,194,213,220,223,237,2430,1,2,3,4,5,20,21,25,33,34,164,165,166,196,3100,1,2,3,4,5,9,11,31,164,165,174,175,176,177,178,194,196Use it like this: