Powershell Exchange mailboxsizes

Hi All,

I need a powershell script that will tell me mailboxes above 1gb, I then need the name and email address and the move this mailboxes to a different dag. how do I do this?

thank you in advance.

Kelly GarciaSenior Systems AdministratorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

$mailboxes = get-mailbox -resultsize unlimited | where {$_.issuewarningquota -ge 900mb}
foreach ($mailbox in $mailboxes) {
  $stats get-mailboxstatistics $mailbox
  if ($stats.totalitemsize.value.togb() -ge 1) {
   'Account {0} located on {1} - {2} is using {3} mb of storage' -f $mailbox.samaccountname, $mailbox.servername, $mailbox.database.tostring(), $size.value.tomb()

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tom CieslikIT EngineerCommented:
To see maiboxes grader than 1GB you can use this command

get-mailbox | Get-MailboxStatistics | where {$_.TotalItemSize -ge 1GB} |Sort-Object TotalItemSize

To export list to c:\temp\MailboxesOver1GB.csv   (C:\Temp must exist on Exchange server)

get-mailbox | Get-MailboxStatistics | where {$_.TotalItemSize -ge 1GB} |Sort-Object TotalItemSize |Export-CSV c:\temp\MailboxesOver1GB.csv

To move it to different DAG you need to specify some more information about it.
Tom CieslikIT EngineerCommented:
This will give you all information about mailbox but if you want to limit it only to DisplayName and mailbox size then use this:

get-mailbox -ResultSize Unlimited | Get-MailboxStatistics | where {$_.TotalItemSize -ge 3GB} |Sort-Object TotalItemSize -Descending |Select-Object DisplayName,TotalItemSize |Export-CSV c:\temp\mailboxesOver3GB.csv
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.