Functions/FileSystem/Get-ItemMetadataMap.ps1
Function Get-ItemMetadataMap { Param ( # Path you want to get the metadata on [Parameter(Mandatory=$True)] [String] $Path ) Process { $oShell = New-Object -ComObject Shell.Application $oFolder = $oShell.Namespace("$Path") $ItemMetaData = for ($i = 1; $i -lt 320; $i++) { $Detail = $oFolder.GetDetailsOf($Null, $i) if($Detail){[pscustomobject]([ordered]@{Num=$I;Name=$Detail})} } $ItemMetaDataMap = [ordered]@{} $ItemMetaData | group Name | sort Name | foreach {$ItemMetaDataMap.Add($_.name,$_.group.Num)} if($ItemMetaDataMap){$ItemMetaDataMap} $oShell = $Null } } |