title: Add content to csv with Add-Member
body: <p>I've got a csv export from Active Directory which looks like this:</p>
  
  <pre>
  Name,"GivenName","Surname","Department","LogonWorkstations"
  jdoe,"John","Doe","Finance","pc1"
  fbueller,"Ferris","Bueller","Sales","pc2"
  </pre>
  
  <p>Now I want to search on each Workstation, check if a folder exists and write that information back into the csv.</p>
  
  <pre><code>$input = Import-Csv "C:\Scripts\input.csv"
  
  ForEach ($line in $input) {
      $wst = $line.LogonWorkstations
      If ($wst -ne "") {
          If (Test-Connection $wst -Count 1 -Quiet -ErrorAction SilentlyContinue) {
              If (Test-Path "\\$wst\c$\Program Files\xyz" -ErrorAction SilentlyContinue) {
                  Add-Member -InputObject $line -NotePropertyName "xyz" -NotePropertyValue "exists"
              }
          }
      }
  }
  
  $input | Export-Csv "C:\Scripts\output.csv" -NoTypeInformation -Encoding Unicode
  </code></pre>
  
  <p>As you can see in the code, Add-Member adds the additional information to <code>$input</code>, however the information isn't available after exporting it to csv.</p>