Exchange mailbox export getting strange data


This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Don Jones Don Jones 1 year, 2 months ago.

  • Author
  • #28727
    Profile photo of Gary Pietila
    Gary Pietila

    I have a script that does Exchange discovery & then exports to a .csv file.

    The script is hundreds of lines long but the relevant part is:

    $global:LocalMailboxes = Get-Mailbox -resultsize unlimited -ErrorAction Stop
    $global:LocalMailboxes | Export-CSV $global:logpath\Mailboxes_Export_$(Get-Date -UFormat %m-%d-%y_%H-%M-%S_%Z).csv -NoTypeInformation -Encoding UTF8 -ErrorAction Stop

    The problem is in some of the columns in the .csv file I don't receive the expected value.

    For the emailaddress column I get:


    Here is another example from the AcceptMessagesOnlyFrom column:


    Most of the columns have the correct values but about 25% do not. My question is how do I expose these missing values in my .csv export?

  • #28728
    Profile photo of Don Jones
    Don Jones

    That's because the data in those columns is not a single value, but rather a collection of objects – e.g., more than one Proxy Address. CSV isn't designed to handle that kind of hierarchy – they're 'flat file' format.

    You could potentially rig something, depending on what you want those multiple-value columns to look like, but it won't be a simple Export-CSV anymore. You're just asking more from CSV than it's designed to deliver :(.

You must be logged in to reply to this topic.