title: Powershell custom append object to csv file
body: <p>I'm trying to output a custom object to a csv formatted text file as I loop through a for each. One object per line.</p>
  
  <p>But nothing is written to the file.</p>
  
  <p>Is it something with types to be converted ?</p>
  
  <pre><code>$rechten = Get-ADGroupMember -Identity $v -Recursive -ERRORACTION silentlycontinue | Get-ADUser -Property DisplayName -ERRORACTION silentlycontinue | Select-Object Name
  
  Write-Host -ForegroundColor Yellow "ADgroup $v wordt uitgevlooid."
  
  foreach ($rechtenhouder in $rechten) {
      $objResults = New-Object PSObject
      $objResults | Add-Member -MemberType NoteProperty -Name DirectoryPath -Value $objPath
      $objResults | Add-Member -MemberType NoteProperty -Name Identity -Value    $rechtenhouder.name
      $objResults | Add-Member -MemberType NoteProperty -Name Systemrights -Value $accessRight.FileSystemRights
      $objResults | Add-Member -MemberType NoteProperty -Name systemrightstype -Value $accessRight.accesscontroltype
      $objResults | Add-Member -MemberType NoteProperty -Name isinherited -Value $accessRight.isinherited
      $objResults | Add-Member -MemberType NoteProperty -Name inheritanceflags -Value $accessRight.inheritanceflags
      $objResults | Add-Member -MemberType NoteProperty -Name rulesprotected -Value $objACL.areaccessrulesprotected
      $objResults | Add-Member -MemberType NoteProperty -Name Adtype -Value "User"
  
      $arrResults += $objResults
      Add-Content $exportpathtxtappend $objresults
  }
  </code></pre>