Author Archives: Kelsey Epps

Viewing Mailbox Statistics with Get-MailboxStatistics – Office 365 Exchange Online PowerShell

Exchange Online has a number of PowerShell commands that will give you detailed level access into a single or group of mailboxes. One of the more powerful commands is Get-MailboxStatistics.

To get more information on the command, please use this Microsoft site.

https://technet.microsoft.com/en-us/library/bb124612(v=exchg.160).aspx

Connect to Exchange Online with PowerShell

To view Mailbox Statistics for a single mailbox

  1. Get-MailboxStatistics -Identity <UserIdentity>

To view a formatted list of all the parameters on a single mailbox

  1. Get-MailboxStatistics -Identity <UserIdentity> | Format-List

To view Mailbox Statistics for all mailboxes

  1. Get-Mailbox | Get-MailboxStatistics

Disable Access to Exchange Online PowerShell

By default Exchange Online has PowerShell access enabled for all users. The level of access, for the users, is determined by the roles you are assigned in the organization but most security conscious organizations will want to button up and close down access to all users that don’t require it to be enabled.

I will detail a simple method to check access for one account and disable access to that account. For more detailed methods to disable for many accounts, please use this Microsoft KB.

https://technet.microsoft.com/en-us/library/jj984292(v=exchg.160).aspx

Connect to Exchange Online with PowerShell

View the status of a single user

  1. Get-User <UserIdentity> | Format-Table Name,DisplayName,RemotePowerShellEnabled

View the status of all users

  1. Get-User -ResultSize unlimited | Format-Table Name,DisplayName,RemotePowerShellEnabled

Disable access to a single user

  1. Set-User <UserIdentity> -RemotePowerShellEnabled $false

Configure Email Forwarding for an Office 365 (Exchange Online) Mailbox – PowerShell

Configuring email forwarding for an Office 365 (Exchange Online) mailbox can be done in three ways. The user can enable email forwarding on their own using the OWA and editing their settings. This post is going to show how to enable email forwarding on a mailbox from PowerShell. If you are looking at how to complete this with the Exchange Admin Center, please see this post Configure Email Forwarding for an Office 365 (Exchange Online) Mailbox – Exchange Admin Center.

  1. Open a connection to Exchange Online with PowerShell

Make sure to replace “user@domain.com” with the user whose email you want to forward.

Make sure to replace “forward_recipient@domain.com” with the SMTP address to where you want to forward the email to.

  1. If you want to forward email and keep a copy in the local mailbox, execute this command

    Set-Mailbox -Identity “user@domain.com” -DeliverToMailboxAndForward $true
    -ForwardingSMTPAddress “forward_recipient@domain.com”

  2. If you want to forward email and don’t keep a copy in the local mailbox, execute this command

    Set-Mailbox -Identity “user@domain.com” -ForwardingSMTPAddress “forward_recipient@domain.com”

To verify this worked, run the following PowerShell command. This will display the user, the primary SMTP address and the forwarding SMTP address.

Get-Mailbox -Identity “user@domain.com” Format-List DisplayName,PrimarySMTPAddress,ForwardingSMTPAddress

Configure Email Forwarding for an Office 365 (Exchange Online) Mailbox – Exchange Admin Center

Configuring email forwarding for an Office 365 (Exchange Online) mailbox can be done in three ways. The user can enable email forwarding on their own using the OWA and editing their settings. This post is going to show how to enable email forwarding on a mailbox from the Exchange Admin Center. If you are looking at how to complete this with PowerShell, please see this post Configure Email Forwarding for an Office 365 (Exchange Online) Mailbox – PowerShell.

  1. Open Office 365 Admin Center
  2. Navigate to the Exchange Admin Center
  3. Click Recipients
  4. Click Mailboxes
  5. Select the user
  6. Double click the user or click the edit pencil

  7. Click Mailbox Features
  8. Scroll down to Mail Flow and Click View Details

  9. Click to Enable Forwarding
  10. Click Browse and select a user to forward the mail to.
    1. Internal – Select a user from the GAL
    2. External – Select a user from the GAL that is a mail contact or mail user. If the contact or mail enabled user is not there, please use this post to create one.
  11. Choose if you want to keep a copy of the message in the mailbox. By default, the forward won’t keep a copy in the mailbox, it will just forward to the forwarding address
  12. Click OK

Forcing Retention Policy to Run – Office 365 (Exchange Online)

Recently I have been tasked with setting up a pretty complete set of Retention Policies. Rather than waiting for the automatic MRM process to run on its own schedule, we can force it to run using PowerShell.

The KB from Microsoft for the PowerShell command is: https://technet.microsoft.com/en-us/library/aa998864(v=exchg.160).aspx

 

  1. Connect to Exchange Online with PowerShell
  2. Run the following command
    1. Start-ManagedFolderAssistant -Identity “user@domain.com”
    2. Make sure to update “user@domain.com” to the user you want to trigger MRM on.

This will trigger MRM to start to process the mailbox specified.

Where is my data, Office 365/Azure?

Here is a quick and easy way to find the high-level information on where your data is stored. As we know, Microsoft has multiple data centers around the globe. Microsoft will use the country specified, when opening the tenant, as a location for the data. In saying that there are some of the Office 365 services that are not offered in all Microsoft data centers, so you will have to piece together your data location. Exchange, SharePoint and Skype can we seen from the Office 365 Admin center.

Open the Office 365 Admin Center

Expand Settings

Expand Organization Profile

Scroll down to data location

To view the specifics about what Microsoft services are available in your specified region, please use this site.

Where is my data (Microsoft Site)

Office 365 (Exchange Online) Archive Mailbox Size Reporting (PowerShell)

Here are some quick PowerShell commands to report on the size of the Office 365 (Exchange Online) Archive Mailbox size.

Microsoft has this information published in the following KB: https://msdn.microsoft.com/en-us/library/gg576861(v=exchsrvcs.149).aspx

Open a connection to Exchange Online with PowerShell.

The command below will get the get the display name, total archive size and total item count for a specified user:

Get-MailboxStatistics <Identity> -ArchiveFormat-List DisplayName,TotalItemSize,ItemCount

The command below will get the get the display name, total archive size and total item count for all users and then out put the results to a CSV:

Get-Mailbox -Archive -ResultSize Unlimited Get-MailboxStatistics -Archive Select DisplayName,@{name=“TotalItemSize (MB)”;expression={[math]::Round((($_.TotalItemSize.Value.ToString()).Split(“(“)[1].Split(” “)[0].Replace(“,”,“”)/1MB),2)}},ItemCountSort “TotalItemSize (MB)” -Descending Export-Csv C:\Path\FileName.csv” -NoTypeInformation