Link to home
Start Free TrialLog in
Avatar of msretailit
msretailitFlag for Kuwait

asked on

Exchange Power Shell Command

Hello Guys,

Can anyone help out to get me command for seeing Storage Limit Size of all mailboxes in exchange.

Avatar of Busbar
Flag of Egypt image

get-mailbox | fl name,*quota*
get-mailbox | ft name,*quota*
Avatar of Meir Rivkin
Get-WMIObject Exchange_Mailbox -Namespace root\MicrosoftExchangeV2 -Computer $server -Filter * | Foreach-Object { 

   $IncludedProperties = "mDBUseDefaults","mDBStorageQuota","mDBOverQuotaLimit","mDBOverHardQuotaLimit" 
   $user = Get-QADUser $_.LegacyDN -IncludedProperties $IncludedProperties 

     Add-member -InputObject $_ NoteProperty mDBUseDefaults $user.mDBUseDefaults 
     Add-member -InputObject $_ NoteProperty mDBStorageQuota $user.mDBStorageQuota 
     Add-member -InputObject $_ NoteProperty mDBOverQuotaLimit $user.mDBOverQuotaLimit 
     Add-member -InputObject $_ NoteProperty mDBOverHardQuotaLimit $user.mDBOverHardQuotaLimit –PassThru 

} | Select-Object MailboxDisplayName,Size,mDBUseDefaults,mDBStorageQuota,mDBOverQuotaLimit,mDBOverHardQuotaLimit

Open in new window

You may need to consider the users who are set to use database  limits. Check out this article.
Avatar of msretailit


Hello busbar,

Can you please let me know how can i export it into CSV with all colums.
get-mailbox | select-object name,*quota* | Export-csv c:\mailboxreporting.csv
That was so easy command to run

Thanks Busbar
you are welcome anytime.
I think something is wrong , Default Limit are also showing unlimited Limits.

Can you please try Busbar
@ msretailit, Did you check my post?
Hello Subsun,

I have tried below command

Get-Mailbox | Select-Object DisplayName,Database,IssueWarningQuota,ProhibitSendQuota,ProhibitSendReceiveQuota | Sort-Object DisplayName | Export-Csv –Path .\MailboxLimits.csv –NoTypeInformation

But still its showing unlimited mailbox size for the users who have default mailbox size.
As I mentioned in my previous post, you might need to check the database limits if user is set to use it. You can refer the article which explains the same..
Hello Subsun,

Yes our users are having database limits but few of them have unlimited size.

So for me its hard to identify which users actual have unlimited and which users have default limit.

By the article i understand that is explains me  how can i manage the mailbox database sizes.

I want to see which users have default mailbox size and which users have unlimited mailbox size.
Avatar of SubSun
Flag of India image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
All of that was done in a single line

(Edit: Off-topic comments removed. Modulus_Twelve.)
Hello Subsun,

Got Following Error

"Bad numeric constant: 12..
At line:1 char:4
+ 12. <<<< PS1
    + CategoryInfo          : ParserError: (12.:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : BadNumericConstant"
he is trying to convince you with a script that you couldn't utilize for 2 days and I solved that with a simple and single line in 15 minutes.

(Edit: Off-topic comments removed. Modulus_Twelve.)
Hello Busbar,

Yes i got what i need but i let you know about the issue of the results that is its showing default mailbox size as unlimited.
@Busbar, I am not trying to convince but trying give a working solution. It's true that get-mailbox will give the quota details of mailbox but the result will be incorrect if the mailbox is set to UseDatabaseQuotaDefaults $true.

For example If mailbox is set to UseDatabaseQuotaDefaults $true and the database has a limit of 200 MB. The get-mailbox command still shows the result as Unlimited (or what ever values it was set to) which is not the actual limit of the mailbox.

@msretailit, I didn't test the script, I will check it as soon as I get a chance.
BTW I didn't note that msretailit has issues with the default sizes.

This could be simple addressed by selecting UseDatabaseQuotaDefaults , then the command would be

get-mailbox | select-object name,*quota*, UseDatabaseQuotaDefaults | Export-csv c:\mailboxreporting.csv

that will highlight the users with the default quota applied.
That still wont give the actual limit in result file. Again we need to check what is the limit set on the database to find the actual limit. it's a pain if there is different limit set for different databases.
@msretailit, I just tried the script it didn't give me any error.. Also I don't have any line in the script 12. PS1. Can you tell me how you are running the script?

You can either copy the code to a text file and save it as .ps1 file (report.ps1) and run it from EMS.

[PS] C:\>.\report.ps1

Or just copy paste the code to EMS and press enter..
My suggestion is to reopen the question as the  current solution is incomplete and award points once the solution is finalized..
Hello Admin,

From Busban answer i got what i need but then i re-verified it then i was having problem with unlimited\ default mailbox size.

As i am new to expertexchange, I am not sure how we can reopen this question.

Subsun :- Command is working may be i did mistake for before.

Is it possible if we can add "UseDatabaseQuotaDefaults" on the script which you given.

As it will be more beneficial if see we if they are using Database Default Quota.
Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello Subsun,

Thanks alot thats perfect,

Is it possible if we can add actual mailbox size used in the report.
Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Subsun,

Admin :- Subsun given me perfect answer, You can give points to Subsun.
Thanks Subsun