Advertisement
Lee_Dailey

function Get-AvailableExtendedFilePropertyTable

Mar 31st, 2018
829
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Get-AvailableExtendedFilePropertyTable
  2.     {
  3.  
  4.     <#
  5.     Comment Based Help goes here ...
  6.     #>
  7.  
  8.     [CmdletBinding()]
  9.     Param
  10.         (
  11.         # add something to get only the matching names?
  12.         )
  13.  
  14.     begin
  15.         {
  16.         $Path = 'C:\'
  17.         $MetaDataLookup = [ordered]@{}
  18.         $DefaultNameSpace = (New-Object -ComObject Shell.Application).NameSpace($Path)
  19.         }
  20.  
  21.     process
  22.         {
  23.         # the 400 seems to be a magic number indicating the max possible items
  24.         foreach ($Index in 1..400)
  25.             {
  26.             $DefaultNameSpace.GetDetailsOf($DefaultNameSpace, $Index) |
  27.                 Where-Object {-not [string]::IsNullOrEmpty($_)} |
  28.                 ForEach-Object {$MetaDataLookup.Add($_, $Index)}
  29.             }
  30.         }
  31.  
  32.     end
  33.         {
  34.         $MetaDataLookup
  35.         }
  36.  
  37.     } # end >> function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement