Powershell Append CSV

powershell

Solution

The documentation suggests that there is an `-append` flag. The example given ends with

|  export-csv –append –path \\Archive01\Scripts\Scripts.csv

Have you tried that? It works fine for me. I'm on version 3, if that matters.

Problem

I am trying to append a CSV file. Here are the lines I am using. I wasn't able to find an append option for export-csv unfortunately. Any ideas would be helpful to get this to work. ``` Get-ADGroupMember "Domain Admins" | select name, samaccountname | Export-Csv c:\bin\DomainAdmins.csv $admins = Import-Csv C:\bin\DomainAdmins.csv foreach ($i in $admins) {Get-ADUser $i.samaccountname -properties * | select name, lastlogondate | Export-Csv c:\bin\dalogon.csv} ```

Original source