locked
EMS - Select-Object ReplayLagTimes doesn't show up correctly when exported to CSV RRS feed

  • Question

  • Hello:

    Does anyone have a fix for this? Thanks.

    The CSV output from the command below looks good except ReplayLagTimes, which has a value of System.Collections.Generic.KeyValuePair`2[Microsoft.Exchange.Data.Directory.ADObjectId,Microsoft.Exchange.Data.EnhancedTimeSpan][]. If I omit the "| Export-Csv D:\Temp\MB-DB-info.csv" part at the end, the console output shows ReplayLagTimes correctly.

    Get-MailboxDatabase -Identity MB-* | Select-Object Name, EdbFilePath, LogFolderPath, ReplayLagTimes | Export-Csv D:\Temp\MB-DB-info.csv

    Thursday, April 14, 2011 2:01 PM

Answers

  • Hi SysAdmin-E.com,

    The ReplayLagTimes property is an array of objects.

    If you want to export it to CSV file, please use this cmdlet:

    Get-MailboxDatabase -Identity MB-* | Select-Object Name, EdbFilePath, LogFolderPath,@{Name='ReplayLagTimes';Expression={[string]::join(";",($_.ReplayLagTimes))}} | export-csv D:\Temp\MB-DB-info.csv


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Marked as answer by emma.yoyo Thursday, April 21, 2011 1:20 AM
    Tuesday, April 19, 2011 2:52 AM

All replies

  • Hi

    If you run the command without the Export-CSV, I assume all is OK?

    What version of Exchange are you using?

    Sukh

    Thursday, April 14, 2011 2:17 PM
  • Oh, forgot to mention, Exchange Server 2010 SP1 Update Rollup 3 v3. Yes, without the Export-CSV part, the console output shows ReplayLagTimes correctly. It seems like a bug in PS.
    Thursday, April 14, 2011 2:53 PM
  • Hi

    What if you Get-MailboxDatabase -Identity MB-* | Select-Object Name, EdbFilePath, LogFolderPath, ReplayLagTimes > c:\mb.txt

    then import to excel, I assume this will work and a workaround?

    Sukh

    Friday, April 15, 2011 9:37 AM
  • I didn't really need it in CSV format, so text will be fine. I was just wondering why it didn't work correctly in CSV. Thanks.
    Friday, April 15, 2011 2:30 PM
  • Hi SysAdmin-E.com,

    The ReplayLagTimes property is an array of objects.

    If you want to export it to CSV file, please use this cmdlet:

    Get-MailboxDatabase -Identity MB-* | Select-Object Name, EdbFilePath, LogFolderPath,@{Name='ReplayLagTimes';Expression={[string]::join(";",($_.ReplayLagTimes))}} | export-csv D:\Temp\MB-DB-info.csv


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Marked as answer by emma.yoyo Thursday, April 21, 2011 1:20 AM
    Tuesday, April 19, 2011 2:52 AM