If you need to read an extended attribute for a Windows Media Center TV show, then this is how you have to do it. The trick is you have to parse the folder, it cannot be read from the file itself.
This little function takes a path and file name as the first variable and the attribute name as the second parameter.
Param([String] $r, [String] $a) # r = file, a = attribute
[String] $private:p = ""
[String] $private:f = ""
[String] $private:v = ""
$ShellApp = New-Object -ComObject Shell.Application
$p = Split-Path $r
$f = Split-Path $r -leaf
$ShellFolder = $ShellApp.Namespace($p)
If($_.path -eq $r)
$v = $_.ExtendedProperty($a)
If($v -eq "")
$v = "NULL"
Post a Comment