Skip to content

Instantly share code, notes, and snippets.

@lordmuffin
Created May 30, 2014 16:51
Show Gist options
  • Save lordmuffin/4504eade6c0fa0b08626 to your computer and use it in GitHub Desktop.
Save lordmuffin/4504eade6c0fa0b08626 to your computer and use it in GitHub Desktop.
## Get all mailbox email addresses and output to csv
$mbx = Get-Mailbox -ResultSize Unlimited | Select DisplayName, EmailAddresses
$foreach = Foreach($mailbox in $mbx) {
New-Object PSObject -Property @{
DisplayName = $mailbox.DisplayName
EmailAddresses = [String]$mailbox.EmailAddresses
}
}
$foreach | Select DisplayName, EmailAddresses | Export-Csv -Path C:\Scripts\mbx-email-addresses.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment