Exchange Shell Command to exclude system mailboxes and send mail automatically

I have exchange 2013 powershell script to get the output of all mailboxes and want the output .csv file it to be sent automatically as a email but excluding system mailboxes and mailboxes starts with Exchange*.  But the below command doesn't gives output of all users, instead it reports only for the quota modified user accounts. How to get the report for the all users with below column.

NAME, EMAILID,DATABASEQUOTA,ISSUEWARNING,PROHIBITSENDQUOTA,PROHIBITSENDRECEIVEQUOTA,TOTALITEM,TOTALITEMSIZEINMB

Get-Mailbox -ResultSize Unlimited | Where {$_.UseDatabaseQuotaDefaults -eq $false} | Select-Object DisplayName, IssueWarningQuota, ProhibitSendQuota, @{label="TotalItemSize(MB)";expression={(Get-MailboxStatistics $_).TotalItemSize.Value.ToMB()}}, @{label="ItemCount";expression={(Get-MailboxStatistics $_).ItemCount}}, Database | Export-Csv "C:\Scripts\UserMailboxSizes.csv" NoTypeInformation

Experts! please help!

February 24th, 2015 5:30am

I want two things, 

a) The existing shell doesn't gives report for all users. It gives output only for quota modified users mailboxes.

b) I want to send mailbox report automatically using the same command.

how to achieve the same.

Free Windows Admin Tool Kit Click here and download it now
February 24th, 2015 12:10pm

Hi,

To get report for all users, just remove this condition Where {$_.UseDatabaseQuotaDefaults -eq $false}. Then select the object from the results based on your requirement.

So I edit you script, here it is:

Get-Mailbox -ResultSize Unlimited | Select-Object Name, EmailAddresses, IssueWarningQuota, ProhibitSendQuota, ProhibitSendReceiveQuota, @{label="TotalItemSize(MB)";expression={(Get-MailboxStatistics $_).TotalItemSize.Value.ToMB()}}, @{label="ItemCount";expression={(Get-MailboxStatistics $_).ItemCount}} | Export-Csv "C:\Scripts\UserMailboxSizes.csv" NoTypeInformation

This script will give the following column:

NAME, EMAILID(EmailAddresses), ISSUEWARNING, PROHIBITSENDQUOTA, PROHIBITSENDRECEIVEQUOTA, TOTALITEM, TOTALITEMSIZEINMB

We cannot get DATABASEQUOTA with Get-Mailbox and Get-MailboxStatistics cmdlet, and we cannot send this report automatically using the same command.

Best Regards.

February 25th, 2015 2:38am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics