SOLVED

How to modify script to export results to CSV:

Copper Contributor

How to modify script to export results to CSV:

 

Get-Mailbox | Where {$null -ne $_.ForwardingSmtpAddress} | FT UserPrincipalName,ForwardingSmtpAddress,DeliverToMailboxAndForward

2 Replies
best response confirmed by Trell627 (Copper Contributor)
Solution

@Trell627 

 

Hi, LeTrell.

 

You need to replace the "FT" (alias for Format-Table) with Select-Object, after which you can pipe to a CSV file using Export-Csv.

 

Get-Mailbox |
    Where {$null -ne $_.ForwardingSmtpAddress} |
        Select-Object -Property UserPrincipalName,ForwardingSmtpAddress,DeliverToMailboxAndForward |
            Export-Csv -Path "D:\Data\Temp\myExchangeData.csv" -NoTypeInformation;

 

Cheers,

Lain

Thank you!
1 best response

Accepted Solutions
best response confirmed by Trell627 (Copper Contributor)
Solution

@Trell627 

 

Hi, LeTrell.

 

You need to replace the "FT" (alias for Format-Table) with Select-Object, after which you can pipe to a CSV file using Export-Csv.

 

Get-Mailbox |
    Where {$null -ne $_.ForwardingSmtpAddress} |
        Select-Object -Property UserPrincipalName,ForwardingSmtpAddress,DeliverToMailboxAndForward |
            Export-Csv -Path "D:\Data\Temp\myExchangeData.csv" -NoTypeInformation;

 

Cheers,

Lain

View solution in original post