Common commands to report info of mailboxes

Hi all,

Here are several useful reports for mailbox management:

With the following command we can obtain the size of each mailbox in the organization.

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

With the following command we can get the information exported to a csv file.

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

With the following command we can obtain the total of items in each mailbox.

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

With the following command we can get the primary SMTP addresses and exported to csv.

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

With the following command we can obtain the statistics of the mailboxes in Mega Bytes and exported to csv.

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

With the following command we can obtain the statistics of the mailboxes in Mega Bytes and exported to Html

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

With the following command we can obtain the statistics of the mailboxes in Mega Bytes and in descending 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

With the following command we can obtain the size and quota of mailboxes that are larger than their specified 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:\temp\quotas_excedidas.csv” -NoTypeInformation

With the following command we can obtain which permissions are granted on the mailboxes of the organization.

Get-Mailbox | Get-MailboxPermission | where {$_.user.tostring() -ne “NT AUTHORITYSELF” -and $_.IsInherited -eq $false} | Select Identity,User,@{Name=’Access Rights’;Expression={[string]::join(‘, ‘, $_.AccessRights)}} | Export-Csv -NoTypeInformation c:\temp\mailboxpermissions.csv

Regards!

Anuncios

Searching mailbox items on Exchange Online

Hi all,

If you need to find email items on a mailbox in your Exchange Online environment and export to a pst file follow the below steps.

Go to Ofice 365 and push on Security and Compliance tile.

search_items01

In Content search push on + icon.

search_items02

On the new window push a reference name and select:

  • Custom location selection
  • Choose specific mailboxes to search
  • Push on +

search_items03

Push on + Add condition and indicate Participants -> contains any of -> and indicate email addressess.

If you need more conditions like date push on +Add condition and select Date -> after -> and date like in the image.

Push on Search.

search_items04

In Content search you will see the new search generated. In the right pane you can see the options and the total items obtained. Push on Preview search results to check if it is what you are looking for.

search_items05

That’s is:

search_items06

Coming back to Content search area y0u are ready to download to a pst file the email items. Will appear a new window asking how you want to save it.

Once selected your preferences, push on Start export.

search_items07

Copy to clipboard the key.

search_items08

Will appear a new window, push on Install.

search_items09

Wait the download.

search_items010

On the new window, paste the key and select where to save the file. Push on Start.

search_items011

Will start the download and after a few minutes, depending the weight, it will finish.

search_items012

Regards!

Force Online Archive when main mailbox is full

Hi!

These days I am migrating from GMail to Exchange Online and I have found that if the user fills his main mailbox and you enable archiving this does not go into action at same moment, yo noeed to wait for 30-60 minutes.

For this you have to force it from powershell with the following command:

Start-ManagedFolderAssistant –Identity <mailbox>

archive

Regards

 

Mail Flow Statistics on Office 365

Hello,

Today my customer request me about outbound mail flow statistics on Office 365 for his tenant.

I used the following syntax:

Get-MailTrafficReport -AggregateBy hour -StartDate 05/06/2016 -EndDate 06/01/2016 -EventType goodmail -Direction outbound | select date,messagecount > c:\temp\StatisticsO365.txt

This is the output:

Date MessageCount
—- ————

06/05/2016 6:00:00 6
06/05/2016 7:00:00 6
06/05/2016 8:00:00 11
06/05/2016 9:00:00 9
06/05/2016 10:00:00 8
06/05/2016 11:00:00 15
06/05/2016 12:00:00 12
06/05/2016 16:00:00 1
06/05/2016 18:00:00 1
08/05/2016 16:00:00 1
09/05/2016 6:00:00 12
09/05/2016 7:00:00 16
09/05/2016 8:00:00 13
09/05/2016 9:00:00 14
09/05/2016 10:00:00 11
09/05/2016 11:00:00 15

Regards!

Requisites and commands to connect to O365 – Exchange Online

Hi guys,

To connect to Exchange Online thru powershell install:

Windows Azure Active Directory Module for Windows PowerShell

http://go.microsoft.com/fwlink/p/?linkid=236297

Microsoft Online Services Sign-In Assistant for IT Professionals RTW:
http://go.microsoft.com/fwlink/p/?linkid=286152

Once installed, execute powershell console and import Azure modules to your powershell session, after login to your tenant with:

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

It’s all.

Regards

How to solve MigrationInvalidTargetAddressException error

Hi!

I’m involved in a Staged Migration project from Exchange 2007 Sp3 to O365 and I found various problems uploading identites to O365.

My Scenario is:

Forest A with FFL and DFL 2003 with Resources Subdomain with Exchange 2007 SP3 and Users Subdomain where are all user accounts.

Forest B with FFL and DFL 2008 R2 where have a syncro of all users from Subdomain on Forest A.

After I configuring AD Connect and execute users syncronization to Office 365 I saw the following error:

Error: MigrationInvalidTargetAddressException: A valid primary email address user@domain.com couldn‎’t be found on the target.

My problem was that not all user attributes were syncronized from Users subdomain in Forest A to Forest B.

Cheking all attributes I found that I needed the following attributes to syncro from Forest A to Forest B:

extensionAttribute1
legacyExchangeDN
mailNickname
msExchMailboxGuid
msExchRecipientDisplayType
msExchRecipientTypeDetails
proxyAddresses 

Once done, the problem disappeared automatically.

Here you can see all attributes that Exchange Online need from users, contacts and groups.

https://azure.microsoft.com/en-us/documentation/articles/active-directory-aadconnectsync-attributes-synchronized/

Regards!