Need help with PS Get-Mailbox command?

355LT1
355LT1 used Ask the Experts™
on
Is there an exchange 2007 power shell command to report all users with databse name created in a month such as just July or just this August.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Get-Mailbox | Where-Object {$_.WhenCreated –ge ((Get-Date).Adddays(-30))} | ft name, servername, database

You can export the results to csv file by appending > C:\mailbox.csv

http://www.howexchangeworks.com/2009/09/task-get-list-of-mailboxes-that-was.html

- Habz
Get-Mailbox | Where-Object {$_.WhenCreated –ge ((Get-Date).Adddays(-30))} | ft name, servername, database, WhenCreated

The above command will help you pull the list of mailboxes which have been created in past 30 days, you can increase value as you required to pull the records.

Get-Mailbox | Where-Object {($_.WhenCreated).Year –eq 2011} | ft name, servername, database, whencreated | Export-CSV c:\mailboxes.csv

You can use the above command to pull the mailboxes created through the year and filter them accordingly in the CSV format.
Top Expert 2011

Commented:
If you want to use a specific time span you could also add a second where like this:

Get-Mailbox | Where-Object {($_.WhenCreated) -ge "7/1/2011"} | Where-Object {($_.WhenCreated) -le "7/31/2011"} | ft name, servername, database, whencreated

This will give you all mailboxes created within Juli 2011

Author

Commented:
Do you know why the CSC file looks like this ?

#TYPE Microsoft.PowerShell.Commands.Internal.Format.FormatStartData
ClassId2e4f51ef21dd47e99d3c952918aff9cd,pageHeaderEntry,pageFooterEntry,autosizeInfo,shapeInfo,groupingEntry
033ecb2bc07a4d43b5ef94ed5a35d280,,,,Microsoft.PowerShell.Commands.Internal.Format.TableHeaderInfo,
9e210fe47d09416682b841769c78b8a3,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
27c87ef9bbda4f709f6b4002fa4af63c,,,,,
Top Expert 2011
Commented:
Yes you may not use the ft with export to csv. Change ft to select

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial