Find Mail Box Size using Powershell

Find Mail Box Size using Powershell

1. From a Windows 7 or 8 machine launch Powershell as administrator

2. Run the following command to launch the Login Screen

$LiveCred = Get-Credential

In the Windows PowerShell Credential Request window that opens, type the credentials of an account in your cloud-based organization. When you are finished, click OK.

3. Run this command to initiate the session

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection

Note The AllowRedirection parameter enables cloud-based organizations in datacenters all over the world to connect Windows PowerShell to the cloud-based service by using the same URL.

4. Import the session using the command

Import-PSSession $Session

.

5. Get the mailbox size using this command

Get-mailbox | Get-Mailboxstatistics | select displayname,TotalItemSize

You can retrieve the info in a csv file by running the following command

Get-mailbox | Get-Mailboxstatistics | select displayname,TotalItemSize | export-csv “c:mailboxsize.csv”

Mail Box Size Including the Item Count

Get-Mailbox | Get-MailboxStatistics | ft DisplayName,TotalItemSize,ItemCount

SMTP Address

Get-Mailbox -ResultSize Unlimited | Select-Object DisplayName,PrimarySmtpAddress | Export-CSV “D:\PrimarySmtpAddress.csv”

Output in Maga Byte

Get-mailbox | Get-Mailboxstatistics | select displayname,TotalItemSize,ItemCount, @{expression={$_.totalitemsize.value.ToMB()};label=”Size(MB)”} | Export-CSV “D:\Username and UPN.csv”

Output in Megabyte in Html file

Get-mailbox | Get-Mailboxstatistics |Sort-Object TotalItemSize -Descending | convertto-html DisplayName, @{label=”TotalItemSize(MB)”;expression={$_.TotalItemSize.Value.ToMB()}} | set-content c:\test.html

Storage Limit and Size ( MB ) in Decending order

Get-mailbox | Get-MailboxStatistics | where {$_.ObjectClass –eq “Mailbox”} | Sort-Object TotalItemSize –Descending | ft @{label=”User”;expression={$_.DisplayName}},@{label=”Total Size (MB)”;expression={$_.TotalItemSize.Value.ToMB()}},@{label=”Items”;expression={$_.ItemCount}},@{label=”Storage Limit”;expression={$_.StorageLimitStatus}} -auto

To view the size and quota status of only those mailboxes that are larger than their configured mailbox quota

Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | where {$_.StorageLimitStatus -notlike “BelowLimit*”} | Select DisplayName,StorageLimitStatus,@{name=”TotalItemSize (MB)”;expression={[math]::Round((($_.TotalItemSize.Value.ToString()).Split(“(“)[1].Split(” “)[0].Replace(“,”,””)/1MB),2)}},@{name=”TotalDeletedItemSize (MB)”;expression={[math]::Round((($_.TotalDeletedItemSize.Value.ToString()).Split(“(“)[1].Split(” “)[0].Replace(“,”,””)/1MB),2)}},ItemCount,DeletedItemCount | Sort “TotalItemSize (MB)” -Descending | Export-CSV “C:\Exceeded Quotas.csv” -NoTypeInformation

==============================================================================

How to Query Active Directory Objects
https://pdtechguru.wordpress.com/2012/10/15/how-to-query-active-directory-objects-3/

Active Directory Health Check
https://pdtechguru.wordpress.com/2012/10/04/active-directory-health-check/

Large Mailbox Items
https://pdtechguru.wordpress.com/2012/10/02/large-mailbox-items/

Find Mail Box Size using PowerShell
https://pdtechguru.wordpress.com/2012/09/28/find-mail-box-size-using-powershell/

Google Chrome Home Page Group Policy
https://pdtechguru.wordpress.com/2012/09/25/google-chrome-group-policy/

How to hide users from GAL
https://pdtechguru.wordpress.com/2012/10/26/how-to-hide-users-from-gal/

Search for Room Mailbox
https://pdtechguru.wordpress.com/2012/10/26/search-for-room-mailbox/

How to Create a Distribution & Security Group using Exchange Management Shell
https://pdtechguru.wordpress.com/2012/10/25/how-to-create-a-distribution-security-group-using-Exchange-management-shell-2/

Find Distribution Group Managed By and SMTP Address
https://pdtechguru.wordpress.com/2012/10/23/find-distribution-group-managed-by-and-smtp-address/

How to Find Duplicate Proxy Address
https://pdtechguru.wordpress.com/2012/10/30/how-to-find-duplicate-proxy-address/

Advertisements

7 thoughts on “Find Mail Box Size using Powershell

  1. Pingback: How to Query Active Directory Objects | pdtechguru

  2. Pingback: Active Directory Health Check | pdtechguru

  3. Pingback: Large Mailbox Items | pdtechguru

  4. Pingback: Google Chrome Home Page Group Policy | pdtechguru

  5. Pingback: How to Create a Distribution & Security Group using Exchange Management Shell | pdtechguru

  6. Pingback: Find Distribution Group Managed By and SMTP Address | pdtechguru

  7. Pingback: How to Find Duplicate Proxy Address | pdtechguru

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s