List of addresses associated with mailbox
Hi We have a bunch of special purpose mailboxes that have multiple email addresses. They are all contained in a file named Special.csv and there are about 20 of them. For each mailbox, I'd like to run a Powershell that will tell me 1. The name of the mailbox 2. The displayname of the mailbox 3. All the email addresses associated with the mailbox ** 4. The primary SMTP address associated with the mailbox Note: For #3, I have found the when I use | fl to get the addresses, if there are many, the Powershell output is cut off with "....." at the end. Does anyone know how I can code Powershell to display ALL the results for that value? This is for Exchange 2007 SP3.
August 25th, 2011 6:41pm

Note: For #3, I have found the when I use | fl to get the addresses, if there are many, the Powershell output is cut off with "....." at the end. Does anyone know how I can code Powershell to display ALL the results for that value? This is for Exchange 2007 SP3. To answer just this right now. Use the -Wrap parameter (PowerShell 2.0): Get-Mailbox <alias> | Format-Table -Wrap Name, DisplayName, PrimarySmtpAddress, EmailAddresses With PowerShell 1.0, you could try with List: Get-Mailbox <alias> | List Name, DisplayName, PrimarySmtpAddress, EmailAddresses But wouldn't it be better to export the results to a .CSV file for easier viewing? Using Format Commands to Change Output View Applies To: Windows PowerShell 2.0 http://technet.microsoft.com/en-us/library/dd347677.aspxMCTS: Messaging | MCSE: S+M
Free Windows Admin Tool Kit Click here and download it now
August 25th, 2011 7:38pm

Now the .CSV file looks like this: --- CSV File --- "Alias" postmaster jas julie ems ----------------- And this would be the script: # Clear the screen Clear-Host # Read .CSV file into array $mailBoxes = Import-Csv -Path c:\Temp\alias.csv # Loop through the array ForEach ($_.Alias in $mailBoxes) { Get-Mailbox $_.Alias | Format-List Name, DisplayName, PrimarySmtpAddress, EmailAddresses } MCTS: Messaging | MCSE: S+M
August 25th, 2011 8:13pm

Thanks all. Is there any command I can run to have the email addresses listed on one line each rather than one after another?
Free Windows Admin Tool Kit Click here and download it now
August 31st, 2011 3:55pm

You mean like this? Felicia is our dog; the e-mail address has been changed, but the output is real: [PS] C:\>Get-Mailbox "felicia" | List Name, DisplayName, PrimarySmtpAddress, @{Name='EmailAddresses';Expression={[string ]::join("`n", ($_.EmailAddresses))}} Name : Felicia Smith DisplayName : Felicia Smith PrimarySmtpAddress : felicia@oslo.net EmailAddresses : smtp:dog@oslo.net smtp:leonberger@oslo.net SMTP:felicia@oslo.net [PS] C:\> Note, you will see that the PrimarySmtpAddress is identical to SMTP: Secondary e-mail addresses are smtp: The PowerShell command ha to be on one line. MCTS: Messaging | MCSE: S+M
August 31st, 2011 7:37pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics