Forum Discussion
Trell627
May 14, 2024Copper Contributor
How to modify script to export results to CSV:
How to modify script to export results to CSV: Get-Mailbox | Where {$null -ne $_.ForwardingSmtpAddress} | FT UserPrincipalName,ForwardingSmtpAddress,DeliverToMailboxAndForward
- May 14, 2024
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
LainRobertson
May 14, 2024Silver Contributor
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
- Trell627May 16, 2024Copper ContributorThank you!