Get-ExtensionAttribute – Script in TechNet Script Gallery

Previously I blogged about listing extended file and folder attributes using the Shell.Application object in PowerShell in my List length and bitrate for mp3 files using Shell.Application article. As a result of that post I decided to write a function, Get-ExtensionAttribute, to properly and consistently be able to list extension attributes even when the locale or version of windows is different.

For this purpose I have created a dynamic parameter -ExtensionAttribute which retrieves all extension attributes available on the system it is run which can be selected and displayed. The function takes path names from either pipeline or as a single path or collection of paths.

.EXAMPLE
Get-ExtensionAttribute -FullName C:\Music -ExtensionAttribute Size,Length,Bitrate

Description
-----------
Retrieves the Size,Length,Bitrate and FullName of the contents of the C:\Music folder, non recursively

.EXAMPLE
Get-ExtensionAttribute -FullName C:\Music\Song2.mp3,C:\Music\Song.mp3 -ExtensionAttribute Size,Length,Bitrate

Description
-----------
Retrieves the Size,Length,Bitrate and FullName of Song.mp3 and Song2.mp3 in the C:\Music folder

.EXAMPLE
Get-ChildItem -Recurse C:\Video | Get-ExtensionAttribute -ExtensionAttribute Size,Length,Bitrate,Totalbitrate

Description
-----------
Uses the Get-ChildItem cmdlet to provide input to the Get-ExtensionAttribute function and retrieves selected attributes for the C:\Videos folder recursively

.EXAMPLE
Get-ChildItem -Recurse C:\Music | Select-Object FullName,Length,@{Name = 'Bitrate' ; Expression = { Get-ExtensionAttribute -FullName $_.FullName -ExtensionAttribute Bitrate | Select-Object -ExpandProperty Bitrate } }

Description
-----------
Combines the output from Get-ChildItem with the Get-ExtensionAttribute function, selecting the FullName and Length properties from Get-ChildItem with the ExtensionAttribute Bitrate

The complete function is available in the TechNet Script Library. To view this script or to participate in the discussions about this script either comment here or in the TechNet Script Library.

TechNet Script Library
My entries in TechNet Script Gallery
Get-ExtensionAttribute

One thought on “Get-ExtensionAttribute – Script in TechNet Script Gallery

  1. Marcelo Mello

    Hi, I am a complete noob looking for a way to list the latitude and longitude of a bunch of pictures with that info embedded … your script is exactly what I was looking for except I can’t see those attributes (working on Windows 10). Any suggestion?

    Best regards,
    Marcelo Mello

    Reply

Leave a Reply

Your email address will not be published.