# Urgent request for Powershell code

**URL:** <https://forums.powershell.org/t/urgent-request-for-powershell-code/1572>\
**Category:** PowerShell Help\
**Created:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/urgent-request-for-powershell-code/1572 "2011-12-31T18:30:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![archives](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@archives](https://forums.powershell.org/u/archives)\
**Post date:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/urgent-request-for-powershell-code/1572/1 "2011-12-31T18:30:00Z")

</div>

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\>  
>   
>   
> Jason

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

> 2007

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

> Hi,  
>   
> 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."  
>   
> Br

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 9:02pm UTC](https://forums.powershell.org/t/urgent-request-for-powershell-code/1572/2 "2024-05-16T21:02:42Z")

</div>


