Urgent request for Powershell code

by ogaal at 2013-02-15 07:27:35

Hi Guys,

i have about 250 mailbox in one storage group. what i need is to get the user names associated with these accounts & pipe them into a csv file using powershell. i am not an advanced pshell user so can you please advice me of a code that could use for this task?

thank you.
by JasonHelmick at 2013-02-15 09:00:17
Hi ogaal!

I don;t have Exhcnage available at my finger tips, but try something like this:

Get-MailBox -Database <nameofDatabase> | Select-Object -property name | Export-csv c:&lt;pathandFilename>

by DonJ at 2013-02-16 07:07:42
FYI: In the future, please try to give your posts a title that better describes what you are asking. “Urgent request for code” could be anything; “Need to get mailbox names” would help the right expert notice your post more quickly.
by ogaal at 2013-02-18 04:32:42
Hi Jason,

thanks for for the help… i have tried running the above command but it does not return anything…

DonJ you are right. thanks for the advice. i will post another one with an appropriate tittle.
by JasonHelmick at 2013-02-18 07:21:55
Hey ogaal!

I should have asked this first…what version of exchange or you running?
by ogaal at 2013-02-18 08:11:19
by JasonHelmick at 2013-02-18 08:35:19
Thanks! The above example does in fact work on 2007…can you show me what your typing? Here’s what I just did on a 2007 box:

Get-MailBox -Database SalesDatabase | Select-Object -Property Name | Export-Csv -PAth c:\List.csv
by Slashj at 2013-02-21 08:18:19

I tested jasons code and i can confirm that it works without problems.

One thing that comes in mind is, does your powershell session run with enough rights to do what you wanna do?
Cause i sometimes forget about running it with my exchangeadmin account and run into an error that goes like:

"Get-Mailbox : Database “Server\Storage\database” was not found. Please make sure you have typed it correctly."