none
Exporting multiple outcomes to a CSV (Powershell Novice) RRS feed

  • Question

  • Hi,

    I'm trying to run the cmdlet below for multiple users mailboxes. I'm trying to achieve the outcome of viewing a list of all users who's mailboxes have a forward on.

    Get-Mailbox TestUser | Select Name,ForwardingAddress,DeliverToMailboxAndForward | Export-CSV C:\forward.csv

    This displays the information I need but removes the previous data. 

    Help? 

    Thanks, 

    Sam 

    Monday, December 7, 2015 2:58 PM

Answers

  • Hi Sam,

    Usually I'd suggest adding the -Append parameter to Export-Csv, but that requires at least v3 of PowerShell.

    You can try something like this instead:

    'TestUser1','TestUser2','TestUser3' | 
        Get-Mailbox |
            Select Name,ForwardingAddress,DeliverToMailboxAndForward |
                Export-Csv .\forwardInfo.csv -NoTypeInformation


    • Proposed as answer by FWN Monday, December 7, 2015 3:27 PM
    • Marked as answer by Elaine JingModerator Tuesday, December 8, 2015 9:50 AM
    Monday, December 7, 2015 3:04 PM
    Moderator

All replies

  • Hi Sam,

    Usually I'd suggest adding the -Append parameter to Export-Csv, but that requires at least v3 of PowerShell.

    You can try something like this instead:

    'TestUser1','TestUser2','TestUser3' | 
        Get-Mailbox |
            Select Name,ForwardingAddress,DeliverToMailboxAndForward |
                Export-Csv .\forwardInfo.csv -NoTypeInformation


    • Proposed as answer by FWN Monday, December 7, 2015 3:27 PM
    • Marked as answer by Elaine JingModerator Tuesday, December 8, 2015 9:50 AM
    Monday, December 7, 2015 3:04 PM
    Moderator
  • That's Awesome :) Thank you very much
    Monday, December 7, 2015 3:17 PM
  • Cheers, you're very welcome.

    Monday, December 7, 2015 3:18 PM
    Moderator