title: Powershell Script to loop through folders checking security permissions
body: <p>I have part of the code: at the moment its coming empty in the CSV file. But i need a command to specify the path/folders to look at, how do i modify this for that purpose.</p>
  
  <pre><code>Param(
      [String]$path,
      [String]$outfile = ".\outfile.csv"
  )
  
  $output = @()
  
  ForEach ($item in (Get-ChildItem -Path $path -Recurse -Directory)) {
  
      ForEach ($acl in ($item.GetAccessControl().Access)){
  
          $output += $acl | 
              Add-Member `
                  -MemberType NoteProperty `
                  -Name 'Folder' `
                  -Value $item.FullName `
                  -PassThru
  
      }
  
  }
  
  $output | Export-Csv -Path $outfile -NoTypeInformation
  </code></pre>