Darylrese Posted August 15, 2013 Posted August 15, 2013 (edited) Hi, I have been asked to give someone a list of all staff email addresses and I believe there is a way to export them from exchange 2010 to a csv file. I have managed to export all users to a CSV using PowerShell, but how do I do it from a specific database only (staff)? Going through 1500+ users to pick staff out is going to be a nightmare. I need a way of extracting them from a specific database or organisational title. Is this possible? I tried this but it didn't work Get-Mailbox -Database "MCA-SR-EX1\MCA Staff.edb" -ResultSize Unlimited |Select-Object DisplayName,ServerName,PrimarySmtpAddress, @{Name=“EmailAddresses”;Expression={$_.EmailAddresses |Where-Object {$_.PrefixString -ceq “smtp”} | ForEach-Object {$_.SmtpAddress}}} | Export-Csv c:\mailbox_alias.csv It returns an error relating to the database line (is not a valid value for the identity) Edited August 15, 2013 by Darylrese
pcstru Posted August 15, 2013 Posted August 15, 2013 (edited) Get-Mailbox * -ResultSize Unlimited | where-object {$_.Database -eq "Staff"} | export-csv c:\tmp\mailbox.csv Edited August 15, 2013 by pcstru
ChrisMiles Posted August 15, 2013 Posted August 15, 2013 (edited) The only thing wrong with your query is that the value of Database should be the display name not that path. Get-Mailbox -Database "MCA Staff" -ResultSize Unlimited |Select-Object DisplayName,ServerName,PrimarySmtpAddress, @{Name=“EmailAddresses”;Expression={$_.EmailAddresses |Where-Object {$_.PrefixString -ceq “smtp”} | ForEach-Object {$_.SmtpAddress}}} | Export-Csv c:\mailbox_alias.csv For example. Edited August 15, 2013 by ChrisMiles 1
Darylrese Posted August 15, 2013 Author Posted August 15, 2013 The only thing wrong with your query is that the value of Database should be the display name not that path. Get-Mailbox -Database "MCA Staff" -ResultSize Unlimited |Select-Object DisplayName,ServerName,PrimarySmtpAddress, @{Name=“EmailAddresses”;Expression={$_.EmailAddresses |Where-Object {$_.PrefixString -ceq “smtp”} | ForEach-Object {$_.SmtpAddress}}} | Export-Csv c:\mailbox_alias.csv For example. This worked perfectly, thank-you! I'm sure I tried this before but obviously I didn't!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now