I'm modifying some powershell code that I found that gets metadata from files recursively, but I'm having trouble accessing the folders within the folders. I get the metadata from the folders that are directly listed under \share, and not the folders and files under there. How can I modify this code to the the metadata from the files within the folders?
Also, I'm trying to get the metadata exported to a CSV, but I just get an empty file.
EDIT: I'm trying to get the data from .pst files. I also found the following line and wondering if I can add this in somehow:
dir \myserver\share -Recurse -Include *.pst | Select FullName
($folder = "\\myserver\share") #end param
function funLine($strIN) 
{
$strLine = "=" * $strIn.length
$hash | Export-Csv c:\pstdetails.csv -NoClobber -NoTypeInformation
# Write-Host -ForegroundColor Yellow "`n$strIN"
# Write-Host -ForegroundColor Cyan $strLine
} #end funline
function funMetaData()
{ 
foreach($sFolder in $folder)
 {
  $a = 0
  $objShell = New-Object -ComObject Shell.Application
  $objFolder = $objShell.namespace($sFolder)
  foreach ($strFileName in $objFolder.items())
  { FunLine( "$($strFileName.name)")
     for ($a ; $a  -le 266; $a++)
      { 
       if($objFolder.getDetailsOf($strFileName, $a))
        {
         $hash += @{ `
              $($objFolder.getDetailsOf($objFolder.items, $a))  =`
              $($objFolder.getDetailsOf($strFileName, $a)) 
         } #end hash
         $hash
         $hash.clear()
          } #end if
      } #end for 
    $a=0
   } #end foreach
 } #end foreach
} #end funMetadata 
 
    