Export-CSV problem
Hi,The powershell command below outputs to the screen properly but becomes garbled when I use export-csv on the command (see example at end). Any help would be appreciated.Get-AgentLog -StartDate "2/03/2010" -EndDate "2/10/2010" | where {$_.recipients -like "rst@my.org" -and $_.reasondata -gt "7"}'|select-object recipients,timestamp,P1fromaddress,p2fromaddresses,reasondata|export-csv c:\admin\rh.csv
-CSV contentsTYPE System.Management.Automation.PSCustomObjectRecipients,Timestamp,P1FromAddress,P2FromAddresses,ReasonDataSystem.Collections.Generic.List`1[Microsoft.Exchange.Management.AgentLog.AgentLogEntry+RoutingAddressWrapper],"2/3/2010 8:58:38 AM",news@newsy.com,System.Collections.Generic.List`1[Microsoft.Exchange.Management.AgentLog.AgentLogEntry+RoutingAddressWrapper],8
February 11th, 2010 12:32am
Don't know if this will work or not. I don't have any agent logs to test with.Get-AgentLog -StartDate "2/03/2010" -EndDate "2/10/2010" | where {$_.recipients -like "rst@my.org" -and $_.reasondata -gt "7"}' |select-object recipients,timestamp,P1fromaddress,p2fromaddresses,reasondata |%{$_.recipients = [string]$_.recipients$_.reasondata = [string]$_.reasondata}|export-csv c:\admin\rh.csv
Free Windows Admin Tool Kit Click here and download it now
February 11th, 2010 3:13am
On Wed, 10-Feb-10 21:32:09 GMT, RTEAL wrote:>>>Hi,The powershell command below outputs to the screen properly but becomes garbled when I use export-csv on the command (see example at end). Any help would be appreciated.Get-AgentLog -StartDate "2/03/2010" -EndDate "2/10/2010" | where {$_.recipients -like "rst@my.org" -and $_.reasondata -gt "7"}'|select-object recipients,timestamp,P1fromaddress,p2fromaddresses,reasondata|export-csv c:\admin\rh.csv You can change your 'select' statement to look like this:select-object@{n='recipients';e={$_.recipients}},timestamp,P1fromaddress,@{n='p2fromaddresses';e={$_.p2fromaddresses}},reasondata---Rich MatheisenMCSE+I, Exchange MVP
---
Rich Matheisen
MCSE+I, Exchange MVP
February 11th, 2010 6:02am
Please use the patterns in this thread to export the output James Luo TechNet Subscriber Support (http://technet.microsoft.com/en-us/subscriptions/ms788697.aspx) If you have any feedback on our support, please contact tngfb@microsoft.com
Free Windows Admin Tool Kit Click here and download it now
February 23rd, 2010 5:46am