Accessing Metadata



Is there a way to access file metadata?

For example the extended information tagged with photos, mp3s etc.



My Computer



<Grins at Keith Hill>

Keith did 99% of the work, but if you don't get the results you expect from
Keith's script, take a look at the improvement I made to his script where I
removed the hard coding. Apparently these properties are not consisent from
machine to machine. I found that if you send a null to the GetDetailsOf
method, it will return to you what the name should be. I have the script
stopping at 40, but there's definitely useful info in the 200's for
pictures. Stuff like focal length, etc. At least in Vista. So if you want
all the info you should change the 40 to 300. I don't know of an official
limit. My improved script is below my sig. (Again, Keith did 99.9% of the

Knox North

begin {

function add-member {
param($type, $name, $value, $input)
$note = ""
$member = new-object $note $name,$value
return $metaInfoObj

function emitMetaInfoObject($path) {
[string]$path = (resolve-path $path).path
[string]$dir = split-path $path
[string]$file = split-path $path -leaf
write-output $file
$shellApp = new-object -com shell.application
$myFolder = $shellApp.Namespace($dir)
$fileobj = $myFolder.Items().Item($file)

$metaInfoObj = new-object psobject
$metaInfoObj.psobject.typenames[0] = "Custom.IO.File.Metadata"
$metaInfoObj = add-member noteproperty Path $path -input

for ( $i=0 ; $i -lt 40; $i++) {
$n = $myFolder.GetDetailsOf($null, $i)

if ($n) {
$v = $myFolder.GetDetailsOf($fileobj,$i)
if ($v) {
$metaInfoObj = add-member noteproperty $n $v -input
write-output $metaInfoObj


process {
if ($_) {
emitMetaInfoObject $_.Fullname


end {
if ($args) {
$paths = @()
foreach ($path in $args) {
if (!(test-path $path)) {
write-error "$path is not a valid path"
$paths += resolve-path $path
foreach ($path in $paths) {
emitMetaInfoObject $path

My Computer


Keith Hill [MVP]

"Knox" <[email protected]> wrote in message
news:[email protected]
> <Grins at Keith Hill>
> Keith did 99% of the work,

Actually James Truher or Lee Holmes (don't remember which) should get the
most credit for this solution. I just took their idea and embellished a


My Computer