Additional Help to the suggested solution

alammfAsked:
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.

AlanConsultantCommented:
Hi,

Taking the solution from that thread, and editing, it would seem to be:

$(Foreach ($mailbox in Get-Recipient -ResultSize Unlimited -OrganizationalUnit Domain.com/HQ/Users -RecipientType UserMailbox){
$Stat = $mailbox | Get-MailboxStatistics | Select TotalItemSize
	New-Object PSObject -Property @{
	DisplayName = $mailbox.DisplayName
	TotalItemSize = $Stat.TotalItemSize
	}
}) | Select DisplayName,TotalItemSize | 
Export-CSV C:\MailboxReport.csv -NTI

Open in new window



Is that what you mean?

Alan.
0
dfkeCommented:
Hi,

open powershell:

Connect to Exchange online
$cred = Get-Credential 
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection 
Import-PSSession $Session

Open in new window


Convert mailbox sizes to MB and export to CSV
get-mailbox -ResultSize Unlimited | 
Get-MailboxStatistics | 
select displayname,@{n="Total Size (MB)";e={[math]::Round( ` 
($_.totalitemsize.ToString().Split("(")[1].Split(" ")[0].Replace(",","")/1MB),1)}} | 
sort "Total Size (MB)" -Descending | 
export-csv "C:\Users\Username\Desktop\MailboxSizeReport.csv" -NoTypeInformation

Open in new window


Cheers
1

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
AlanConsultantCommented:
Dfke's is better :-)
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Todd NelsonSystems EngineerCommented:
Use the following command to get mailbox name and size in MB in a one line command.  No need to run the sort (as shown above) because the output is a CSV format that can be sorted in Excel.  If you want additional columns on mailbox info, add the parameters you want listed after "}}".

Get-Mailbox -ResultSize Unlimited -OrganizationalUnit "OU" | Get-MailboxStatistics | Select-Object DisplayName,@{label="TotalItemSize (MB)";expression={$_.TotalItemSize.Value.ToMB()}} | Export-Csv C:\MailboxSizes.csv -NoType

Open in new window


Depending on your OU structure, the format may need to look something like this "domain.local/OU/Sub-OU" for the OU you plan to target.

References...
0
dfkeCommented:
Hi,

That's my solution in a oneliner basically. Oneliners are nice but can be a pain when you need to figure out why it won't execute correctly.

Either way things should help you out.

Cheers
0
AlanConsultantCommented:
I agree - I think the points should go 750 to DFKE's comment.
0
AlanConsultantCommented:
I think that the original points split that Todd suggested was right, but the 750 should go to DFKE rather than Todd:

DFKE = 750
Todd = 125
Alan = 125

Or alternatively, 1000 to DFKE.

Alan.
0
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
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.