Quantcast
Channel: o365info
Viewing all 370 articles
Browse latest View live

Convert shared mailbox to user mailbox

$
0
0

Multiple users can access a shared mailbox, but you can convert it to a regular user mailbox. You can give a single user full control over the mailbox, including the ability to log in with their own credentials and manage the mailbox as they would with their own personal mailbox. In this article, you will learn to convert a shared mailbox to a user mailbox in Exchange Admin Center (EAC) and PowerShell.

User mailbox vs. shared mailbox

Let’s explain the main differences between a user and a shared mailbox.

User mailbox:

  • Paid license
  • Sign in with your credentials

Shared mailbox:

  • Free license under 50 GB of storage
  • Multiple users accessible (25 persons recommended)
  • Sign in with a user account that has access permission

Note: If you want to store more than 50 GB, you must have Exchange Online plan 2 license assigned to the shared mailbox. And if you need the online archive, you need to assign the Exchange Online plan 1 license to it.

Convert shared to user mailbox in Exchange Admin Center

We will start by converting the mailbox in the new Exchange Admin Center (EAC). The regular and shared mailboxes are in the same list under mailboxes.

You can find the shared mailbox in EAC in three different ways:

  1. Sign in to Exchange Admin Center
  2. Click Recipients > Mailboxes
  3. Check under Recipient type for SharedMailbox
  4. Click Filter > select Shared mailbox
  5. Search for the name of the shared mailbox
Find shared mailbox in Exchange admin center

Follow the steps to convert a shared mailbox to a user mailbox in EAC:

  1. Sign in to Exchange Admin Center
  2. Click on Recipients > Mailboxes
  3. Select the shared mailbox you want to convert
  4. Click Others
  5. Select Convert to regular mailbox
Convert to regular user mailbox in filtered Exchange admin center
  1. Click Confirm
Convert mailbox from shared to regular in Exchange admin center

If the shared mailbox is unlicensed and you convert it to a user mailbox, the result will be an unlicensed user mailbox. It means that you need to assign a license to the user mailbox.

Note: Double-check if your user mailbox has a license assigned. Remember that a user mailbox without a license will be deleted after 30 days.

Verify that you successfully converted to a regular user mailbox by navigating to EAC > Recipients > Mailboxes. Search for the user, and you will see UserMailbox under Recipient type.

Convert shared to user mailbox with PowerShell

Another option to convert a shared mailbox to regular mailbox is with PowerShell:

1. Install Exchange Online PowerShell module.

2. Connect to Exchange Online PowerShell.

Connect-ExchangeOnline

3. Convert shared mailbox to user mailbox using the Set-Mailbox cmdlet. We will use the Regular parameter to tell Exchange we want to set it as a user mailbox type.

Type the shared mailbox display name.

Set-Mailbox –Identity "Amanda Hansen" -Type Regular

Or type the shared mailbox email address.

Set-Mailbox –Identity "Amanda.Hansen@m365info.com" -Type Regular

4. Run the Get-Mailbox cmdlet to verify that it converted the shared mailbox to a regular user mailbox.

Type the user mailbox display name.

Get-Mailbox -Identity "Amanda Hansen" | Format-Table Name, RecipientTypeDetails

Or type the mailbox email address.

Get-Mailbox –Identity "Amanda.Hansen@m365info.com" | Format-Table Name, RecipientTypeDetails

5. The PowerShell console output shows that you successfully converted the shared mailbox to a user mailbox.

PS C:\> Get-Mailbox -Identity "Amanda.Hansen@m365info.com" | Format-Table Name, RecipientTypeDetails

Name                                 RecipientTypeDetails
----                                 --------------------
41377e9c-dc47-46c0-b4a5-1d5bbdcb5cc5 UserMailbox   

6. Always double-check the license to see if it’s correctly set.

Note: Double-check if your user mailbox has a license assigned. Remember that a user mailbox without a license will be deleted after 30 days.

Did you use the Exchange Admin Center or Exchange Online PowerShell to convert your mailbox?

Conclusion

You learned how to convert a shared mailbox to a user mailbox in the Exchange Admin Center (EAC) and Exchange Online PowerShell. A shared mailbox doesn’t always need a license, while a user mailbox does. So remember to add a license after you convert to a regular user mailbox.

Did you enjoy this article? You may also like Save sent items in shared mailbox. Don’t forget to follow us and share this article.


Manage equipment mailbox with PowerShell

$
0
0

In this article, we will show how to manage a Microsoft 365 equipment mailbox with PowerShell. Learn how to create, manage and modify an equipment mailbox. You can also view and export information about the equipment mailbox, convert it to another type, and bulk soft delete it.

Microsoft 365 mailbox types

There are four different mailbox types in Microsoft 365:

  1. User mailbox
  2. Shared mailbox
  3. Room mailbox
  4. Equipment mailbox

Resource mailbox

The resource mailbox doesn’t require a license and is used to manage meetings. Resource mailboxes are useful for managing the schedule of a conference room and allow users to reserve a timeslot.

There are two types of resource mailboxes:

  1. Room mailbox is assigned to a physical location such as a meeting room or conference place.
  2. Equipment mailbox is assigned to objects, not location-specific, such as laptops, cars, or microphones.

Connect to Exchange Online PowerShell

To be able to run the PowerShell commands specified in the current article, you will need to Connect to Exchange Online PowerShell.

Start Windows PowerShell as administrator and run the Connect-ExchangeOnline cmdlet.

Connect-ExchangeOnline

1. Create new equipment mailbox

PowerShell command syntax:

New-Mailbox -Name "<Name>" -Equipment

Run the below PowerShell command example to create a new equipment mailbox.

New-Mailbox -Name "Projector 11" -Equipment

The PowerShell output looks like the below example.

PS C:\> New-Mailbox -Name "Projector 11" -Equipment

Name                      Alias           Database                       ProhibitSendQuota 
----                      -----           --------                       ----------------- 
Projector 11              Projector11     EURPR02DG257-db113             49.5 GB (53,150...

2. Manage equipment mailbox properties

You can manage and change equipment mailbox properties with PowerShell commands.

Change display name and SMTP address

Change the display name and primary SMTP address for an equipment mailbox.

Run the below PowerShell command example.

Set-Mailbox "Projector 11" -DisplayName "Project Pool 11" -EmailAddresses SMTP:ProjectPool11@m365info.com,smtp:Projector11@m365info.com

Verify you changed an equipment mailbox correctly.

Get-Mailbox "Projector 11" | Format-List DisplayName,RecipientTypeDetails,PrimarySmtpAddress

The PowerShell output shows the display name, type, and SMTP email address.

PS C:\> Get-Mailbox "Projector 11" | Format-List DisplayName,RecipientTypeDetails,PrimarySmtpAddress


DisplayName          : Project Pool 11
RecipientTypeDetails : EquipmentMailbox
PrimarySmtpAddress   : ProjectPool11@m365info.com

Allow booking requests for equipment mailbox

Configure equipment mailboxes to allow booking requests to be scheduled only during working hours.

Run the below PowerShell command to allow booking requests.

Get-Mailbox -ResultSize unlimited -Filter "RecipientTypeDetails -eq 'EquipmentMailbox'" | Set-CalendarProcessing -ScheduleOnlyDuringWorkHours $true

To verify that you changed the properties for an equipment mailbox, run the Get-Mailbox cmdlet.

PowerShell command example

Get-Mailbox -ResultSize unlimited -Filter "RecipientTypeDetails -eq 'EquipmentMailbox'" | Get-CalendarProcessing | Fl Identity,ScheduleOnlyDuringWorkHours

The result of the PowerShell output show if the schedule during working hours is enabled (True) for each equipment mailbox.

PS C:\> Get-Mailbox -ResultSize unlimited -Filter "RecipientTypeDetails -eq 'EquipmentMailbox'" | Get-CalendarProcessing | Fl Identity,ScheduleOnlyDuringWorkHours


Identity                    : Projector 11
ScheduleOnlyDuringWorkHours : True

Identity                    : Projector 8
ScheduleOnlyDuringWorkHours : True

Identity                    : Projector 21
ScheduleOnlyDuringWorkHours : True

Enable automatic booking for equipment mailbox

You can manage to enable automatic booking for an equipment mailbox

Use the PowerShell command syntax.

Set-CalendarProcessing "<Identity>" -AutomateProcessing AutoAccept

Run the below PowerShell command example.

Set-CalendarProcessing "Projector 11" -AutomateProcessing AutoAccept

Verify that you enabled the automatic booking for a specific equipment mailbox.

Run the below PowerShell command example.

Get-CalendarProcessing "Projector11" | Fl Identity,AutomateProcessing

See the results of the PowerShell output about this specific equipment mailbox below.

PS C:\> Get-CalendarProcessing "Projector11" | Fl Identity,AutomateProcessing


Identity           : Projector 11
AutomateProcessing : AutoAccept

Bulk enable automatic booking for equipment mailbox

Enable automatic booking for all equipment mailboxes in one PowerShell command

Run the below PowerShell command example.

Get-MailBox | Where {$_.ResourceType -eq "Equipment"} | Set-CalendarProcessing -AutomateProcessing:AutoAccept

You can also check that you enabled the automatic booking correctly using the Get-CalendarProcessing cmdlet.

To verify, run the below PowerShell command example.

Get-Mailbox -ResultSize unlimited -Filter "RecipientTypeDetails -eq 'EquipmentMailbox'" | Get-CalendarProcessing | Fl Identity,AutomateProcessing

The PowerShell output shows all the equipment mailboxes and whether the automatic booking is enabled.

PS C:\> Get-Mailbox -ResultSize unlimited -Filter "RecipientTypeDetails -eq 'EquipmentMailbox'" | Get-CalendarProcessing | Fl Identity,AutomateProcessing


Identity           : Projector 11
AutomateProcessing : AutoAccept

Identity           : Projector 8
AutomateProcessing : AutoAccept

Identity           : Projector 21
AutomateProcessing : AutoAccept

3. Manage equipment mailbox permissions

Assign Send on Behalf permission to equipment mailbox

You can assign a user Send on Behalf permission on a single equipment mailbox.

PowerShell command syntax:

Set-CalendarProcessing "<Identity>" –ResourceDelegates "<Identity>"

Powershell command example:

Set-CalendarProcessing "Projector8@m365info.com" –ResourceDelegates "Chris Lucas"

Now the user “Chris Lucas” is a delegate that can Send on Behalf of the equipment mailbox “Projector8@m365info.com”.

Assign Send As permission equipment mailbox

You can assign a user Send As permission on a single equipment mailbox.

PowerShell command syntax:

Add-RecipientPermission "<Identity>" -Trustee "<Identity>" -AccessRights SendAs -Confirm:$False

PowerShell command example:

Add-RecipientPermission "Projector8" -Trustee "David Kent" -AccessRights SendAs -Confirm:$False

The PowerShell output shows the following result.

PS C:\> Add-RecipientPermission "Projector8" -Trustee "David Kent" -AccessRights SendAs -Confirm:$False

Identity    Trustee                              AccessControlType AccessRights Inherited
--------    -------                              ----------------- ------------ ---------
Projector 8 eec2668a-0773-4947-93ba-2223f6acfe55 Allow             {SendAs}     False    

Assign Full Access permission to equipment mailbox

You can assign a user Full Access permission on a single equipment mailbox.

PowerShell command syntax:

Add-MailBoxPermission "<Identity>" -User "<Identity>" -AccessRights FullAccess

PowerShell command example:

Add-MailBoxPermission "Projector8" -User "Brenda Smith" -AccessRights FullAccess

The PowerShell output shows the following result.

PS C:\> Add-MailBoxPermission "Projector8" -User "Brenda Smith" -AccessRights FullAccess

Identity             User                 AccessRights                    IsInherited Deny 
--------             ----                 ------------                    ----------- ---- 
Projector 8          S-1-5-21-70143928... {FullAccess}                    False       False

4. Display equipment mailbox information

View a list of all Office 365 equipment mailboxes.

Get-Mailbox -Filter '(RecipientTypeDetails -eq "EquipmentMailBox")' | Select Name,Alias

The PowerShell output looks like the below example.

PS C:\> Get-Mailbox -Filter '(RecipientTypeDetails -eq "EquipmentMailBox")' | Select Name,Alias

Name         Alias      
----         -----      
Projector 11 Projector11
Projector 8  Projector8 
Projector 21 Projector21

Display equipment mailbox calendar settings

View the calendar settings for a single equipment mailbox.

PowerShell command syntax:

Get-Mailbox "<Identity>" | Select ResourceType,RejectMessagesFrom,RejectMessagesFromDLMembers,RejectMessagesFromSendersOrMembers,SendModerationNotifications

PowerShell command example:

Get-Mailbox "Projector8" | Select ResourceType,RejectMessagesFrom,RejectMessagesFromDLMembers,RejectMessagesFromSendersOrMembers,SendModerationNotifications

The PowerShell output shows the below result.

PS C:\> Get-Mailbox "Projector8" | Select ResourceType,RejectMessagesFrom,RejectMessagesFromDLMembers,RejectMessagesFromSendersOrMembers,SendModerationNotifications


ResourceType                       : Equipment
RejectMessagesFrom                 : {}
RejectMessagesFromDLMembers        : {}
RejectMessagesFromSendersOrMembers : {}
SendModerationNotifications        : Always

Display equipment mailbox calendar processing settings

You can view information for a single equipment mailbox.

PowerShell command syntax:

Get-Mailbox "<Identity>" | Get-CalendarProcessing | FL

PowerShell command example:

Get-Mailbox "Projector8" | Get-CalendarProcessing | FL

Display equipment mailbox calendar permission

You can view all the calendar access rights for a single equipment mailbox.

PowerShell command syntax:

Get-MailBoxFolderPermission <Equipment:\Calendar> | Select FolderName,User,AccessRights

PowerShell command example:

Get-MailBoxFolderPermission "Projector8:\Calendar" | Select FolderName,User,AccessRights

The PowerShell output shows the below result.

PS C:\> Get-MailBoxFolderPermission "Projector8:\Calendar" | Select FolderName,User,AccessRights

FolderName User        AccessRights    
---------- ----        ------------    
Calendar   Default     {LimitedDetails}
Calendar   Anonymous   {None}          
Calendar   Chris Lucas {Editor}  

Export list of equipment mailboxes to CSV file

You can export information about all equipment mailboxes to a single CSV file. This way, you can easily search for the equipment mailboxes.

PowerShell command syntax:

Get-Mailbox -Filter '(RecipientTypeDetails -eq "EquipmentMailbox")' | Select RecipientTypeDetails,Name,Alias | Export-CSV <Path>

PowerShell command example:

Get-Mailbox -Filter '(RecipientTypeDetails -eq "EquipmentMailbox")' | Select RecipientTypeDetails,Name,Alias | Export-CSV "C:\temp\Equipment Mailboxes Info.CSV" –NoTypeInformation -Encoding UTF8

Once you export the information, you can find the CSV file in the C:\temp folder.

Open the CSV file with an application like Microsoft Excel to see the results.

Manage equipment mailbox with PowerShell export information CSV file

5. Convert equipment mailbox

You can convert an equipment mailbox to another mailbox type.

Run the PowerShell command to convert the equipment mailbox to a shared mailbox.

Get-Mailbox "Projector 11" | Set-Mailbox -Type Shared

Use the PowerShell command to convert the equipment mailbox to the room mailbox.

Get-Mailbox "Projector 11" | Set-Mailbox -Type Room

Run the PowerShell command to convert the equipment mailbox to a regular user mailbox.

Get-Mailbox "Projector 11" | Set-Mailbox -Type Regular

Note: When you convert an equipment mailbox to a user mailbox, you must assign an Exchange Online license within 30 days to activate it.

6. Delete equipment mailbox

You can soft delete an equipment mailbox.

PowerShell command syntax:

Remove-Mailbox -Identity "<Equipment Identity>" -Confirm:$false

PowerShell command example:

Remove-Mailbox -Identity "Projector 11" -Confirm:$false

Bulk soft delete equipment mailbox

Run the below PowerShell command to bulk soft delete equipment mailboxes.

Get-Mailbox -Filter '(RecipientTypeDetails -eq "EquipmentMailBox")' -ResultSize Unlimited | Remove-Mailbox -Confirm:$false

Note: Do you want to know more about how to find, restore, or permanently delete the equipment mailbox in Microsoft 365? Read the article Manage Office 365 recycle bin with PowerShell.

Did this help you to manage Office 365 equipment mailbox with PowerShell?

Conclusion

You learned how to manage equipment mailboxes with PowerShell. There are a lot of possibilities when it comes to managing an equipment mailbox. The most essential tasks are to create, convert, delete, assign permissions, and export a list of equipment mailboxes.

Did you enjoy this article? You may also like Export Microsoft 365 user licenses. Don’t forget to follow us and share this article.

Configure help desk information in Microsoft 365

$
0
0

It’s important to add the organization’s contact information to the Microsoft 365 help pane. This way, users can find the help desk contact details under the default help support. In this article, you will learn to configure help desk information in Microsoft 365.

Microsoft 365 help desk contact

The help desk information displays the company’s support contact. When a user signs into Microsoft 365 and clicks the help button, the help pane opens. If you haven’t configured a help desk information, the user will only find the default Microsoft help support.

When you provide your users with the correct help desk information, they can quickly contact your company’s support.

Configure help desk contact information

How to add a help desk contact information:

  1. Sign in to Microsoft 365 admin center
  2. Click on Settings > Org settings
  3. Click on the Organization profile
  4. Click on Help desk information
Help desk contact information in Microsoft 365 admin center
  1. Select the check box Add your help desk contact information
  2. Fill in the Title
  3. Contact information > Enter the Phone, Email, or URL website
  4. Click Save
Help desk contact information in Microsoft 365 admin center

Check help desk pane

To view the help desk information pane, follow the steps below:

  • Sign into Microsoft 365
  • Click on the question mark (?)
  • Scroll below to see the help desk support you created
View help desk information pane in Microsoft 365

Remember that it’s better to provide the users with more contact information, such as phone number, email, and website.

Note: The user must sign out and sign back into Microsoft 365, Exchange Online, or any other app to see the updated help desk information.

Did this help you to configure the help desk information in Microsoft 365?

Read more: Configure technical contact details in Microsoft 365 »

Conclusion

You learned to configure and change the help desk information in Microsoft 365 admin center. Always check the help desk contact information and modify it when there are updates to support your users. Remember that the user needs to sign back in to see the changes.

Did you enjoy this article? You may also like Enable message recall in Exchange Online. Don’t forget to follow us and share this article.

Import PST file into Microsoft 365 mailbox

$
0
0

Your organization has switched to Exchange Online and needs to migrate its old emails to the new Microsoft 365 account. To get the old emails, we need to create a PST file and import it into the cloud-based Microsoft 365 mailbox. This article will show you how to import a PST file using the Azure Storage Explorer tool into Microsoft 365 mailbox.

How to import PST files into Microsoft 365 account

We want to move multiple mailboxes from an organization server to the new cloud-based Microsoft 365. There are different methods, depending on the size (GB) and how many PST files you need to migrate to Microsoft 365.

We will show you the steps to import multiple PST files (max. 20 GB) into Microsoft 365 mailboxes.

1. Assign Mailbox Import Export role

You must assign the Mailbox Import Export role in Exchange Online to import PST files into user mailboxes. Otherwise, you cannot create a new import job in the Microsoft Purview compliance portal.

Assign Mailbox Import Export role in Exchange Online:

  • Sign in to Exchange Admin Center
  • Click on Roles > Admin roles
  • Select Organization Management
  • Click on the tab Permissions
  • Type import in the search bar
  • Select Mailbox Import Export role
  • Click Save
Microsoft 365 mailbox import export role

Note: Once you save, the changes can take up to 24 hours to apply. Most of the time, it will work within 1 hour.

Suppose you get the below error after clicking Save.

We couldn’t save your changes. Please try again.

Permissions mailbox import export

The best alternative way to assign the Mailbox Import Export role is with PowerShell.

1. Connect to Exchange Online PowerShell and sign in with your Microsoft 365 global administrator credentials.

2. Run the Enable-OrganizationCustomization cmdlet.

Enable-OrganizationCustomization

Suppose your organization already has customization enabled, you get an error message that the operation is not required.

PS C:\> Enable-OrganizationCustomization
Write-ErrorMessage : |System.InvalidOperationException|This operation is not required. 
Organization is already enabled for customization.
At C:\Users\Admin\AppData\Local\Temp\tmpEXO_si2e2btd.nw1\tmpEXO_si2e2btd.nw1.psm1:1120 
char:13
+             Write-ErrorMessage $ErrorObject
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Enable-OrganizationCustomization], InvalidOperationException
    + FullyQualifiedErrorId : [Server=DB9PR02MB7211,RequestId=5c81aa66-1041-a480-31fa-1dd2bf91e3c5,TimeStamp=Fri, 14 Apr 2023 08:58:26 GMT],Write-ErrorMessage

Note: Wait a few minutes before the above change is applied to the Exchange Online servers. Otherwise, the next command will fail.

3. Run the New-ManagementRoleAssignment cmdlet.

New-ManagementRoleAssignment -Role "Mailbox Import Export" -SecurityGroup "Organization Management" -Name "Import Export Org Management"

PowerShell result:

PS C:\> New-ManagementRoleAssignment -Role "Mailbox Import Export" -SecurityGroup "Organization Management" -Name "Import Export Org Management"

Name                          Role                   RoleAssigneeName         RoleAssigneeType  AssignmentMethod  EffectiveUserName                                                                     
----                          ----                   ----------------         ----------------  ----------------  -----------------
Import Export Org Management  Mailbox Import Export  Organization Management  RoleGroup         Direct       

2. Create new PST import job

To create a PST import job in the Microsoft Purview compliance portal, follow these steps:

Import new PST file into Microsoft 365

If you don’t see a New import job, then the changes in the previous steps are not yet applied. There will be a yellow message like the one below.

Note: To create import jobs, you must be assigned the Mailbox Import Export role in Exchange Online. After this role is assigned, it might take up to 24 hours before you can start creating jobs.

Wait until the above warning removes so you can perform the above step.

  • Give the import job a name, e.g. stephenhunter
  • Click Next
Name your job in new import job Microsoft Purview
  • Select Upload your data
  • Click Next
  • Click on Show network upload SAS URL
Import data PST file into Microsoft 365 SAS URL
  • Click on Copy to clipboard
Import PST data into Microsoft 365 Copy SAS URL

In the next step, you will upload the PST file to Microsoft 365 using Azure Storage Explorer.

Note: Keep the Microsoft Purview > New import job window open because you will return to complete the last steps. Don’t cancel the import data, or you will start from the beginning.

3. Install Azure Storage Explorer

We need to download and install the Microsoft Azure Storage Explorer.

Download Microsoft Azure Storage Explorer
  • Run the application and keep the default settings to install the Microsoft Azure Storage Explorer
Run Windows Storage Explorer application

4. Upload PST files uploaded to Microsoft 365

  • Open Microsoft Azure Storage Explorer
  • Click on the Connect Dialog icon
Open Microsoft Azure Storage Explorer application
  • Click on Blob container
Connect to Azure Storage Blob container
  • Select Shared access signature URL (SAS)
Connect to Azure Storage Shared access signature URL (SAS)
  • Insert Display name
  • Paste the SAS URL you copied from the previous step in the Blob container SAS URL
  • Click Next
Connect to Azure Storage Shared access signature URL (SAS)
  • Click Connect
Connect to Azure Storage Shared access signature URL (SAS)

In Microsoft Azure Storage Explorer, you can see the display name of your SAS. Now we need to create a new folder.

  • Click on New Folder
Import PST file into new folder Microsoft Azure Storage Explorer
  • Give the folder a Name, e.g. PST
  • Click OK
Import PST file into Microsoft 365
  • Click Upload
  • Select Upload Files
Upload files into Microsoft Azure Storage Explorer
  • Click on No files selected
Upload files to PST folder
  • Select the PST file and click Open
Import PST file into Microsoft Azure Storage Explorer

Check if you selected the correct file. Also, see if the directory path is your created folder (PST).

  • Click Upload
Upload files to Microsoft Azure Storage Explorer
  • Clear Prompt for conflicts (requires read permission). If disabled, conflicts will be overwritten.
  • Click OK
Microsoft Azure Storage Explorer storage

You will see the .pst file in the PST folder under the Blob Containers in the Microsoft Azure Storage Explorer.

Next time you want to view the PST files you uploaded, you only need to open Azure Storage Explorer and type the display name of the PST file in the search bar.

Note: All PST files are automatically deleted from your Azure storage. The PST files in the ingestiondata container are deleted after 30 days, if no import job is in progress. You can’t delete a PST file or folder under Blob Container in Microsoft Azure Storage Explorer.

You can close the Microsoft Azure Storage Explorer and continue to the next step.

5. Create PST import mapping file

You need to download and save the PstImportMapFile.csv file.

The CSV file includes the following values:

  • Workload: Specifies the service that data will be imported to. It should be set to Exchange to import PST files to user mailboxes.
  • FilePath: Specifies the name of the folder path in the Azure Storage location to which you uploaded the PST files.
  • Name: Specifies the name of the PST file that will be imported to the user mailbox. The value for this parameter is case-sensitive.
  • Mailbox: Specifies the mailbox’s email address to which the PST file will be imported.
  • IsArchive: Specifies whether to import the PST file to the user’s archive mailbox. Set the value TRUE or FALSE. If you choose TRUE, ensure the user’s archive mailbox is enabled.
  • TargetRootFolder: Specifies the mailbox folder that the PST file is imported to. If you leave this parameter blank, the PST file will be imported to a new folder named Imported at the root level of the mailbox (the same level as the Inbox folder and the other default mailbox folders). If you specify /, the folders and items in the PST file are imported to the top of the folder structure in the target mailbox or archive. If you specify /newfoldername, items, and folders in the PST file are imported to a folder named newfoldername.
  • The other fields in the CSV file are optional, so you can leave them empty.

In the next step, we will show you how to edit the CSV file with the Microsoft Excel application.

6. Edit CSV file in Excel

To save the Excel file as CSV comma delimited, you need to make Excel use a comma for the list separator.

  • Open Microsoft Excel
  • Click Options
Options Microsoft Excel

In the Excel Options, you need to make some changes:

  • Click Advanced
  • Under Editing options > Clear System separators
  • Set Decimal separator to period (.)
  • Set Thousands separator to comma (,)
  • Click OK
Advanced Excel Options system separators

Note: Close the Microsoft Excel application to save the changes.

To load data into Microsoft Excel, follow the below steps:

  • Open Microsoft Excel again
  • Select New blank workbook
Open New blank workbook Microsoft Excel
  • Click on Data > From Text/CSV
Microsoft Excel Import Data from CSV
  • Find and select PstImportMapFile.csv
  • Click Import
Import CSV data PSTImportmapFile into Excel
  • Set the delimiter to Comma
  • Click Load
Import CSV data PSTImportmapFile delimiter comma into Excel

Microsoft Excel loads and formats the data from the CSV file.

  • Edit the values like the below example
Import CSV data PSTImportmapFile into Excel

Once you have made your changes, save the file as .csv.

  • Type the File name
  • Save the file type as CSV (Comma delimited)
  • Click Save
Save the file type as CSV (Comma delimited)
  • Open the file with Notepad to double-check if the CSV file is comma delimited
Save the file type as CSV (Comma delimited) in Notepad

7. Select CSV mapping file

Go back to the Microsoft Purview > New import job window

  • Select I’m done uploading my files
  • Select I have access to the mapping file
  • Click Next
Import data and select mapping file done
  • Click on Select mapping file
  • Browse and select the PstImportMapFile.csv file
  • Click on Validate
Select mapping file and validate the CSV file

It shows a green text, which means that it’s valid.

  • Click Next
Valid CSV mapping file selceted

Review the PST import job.

  • Click Submit
Review PST import job and submit

Upload to the cloud succeeded.

  • Click Done
Upload import job to the cloud succeeded

You are not finished yet, because the analysis is in progress. The last step is where we will start the PST import into Microsoft 365.

Note: Wait for the analysis to complete, which can take several minutes or an hour. You can safely close the Microsoft Purview window.

8. Import PST into Microsoft 365

Once it shows Status > Analysis completed and Progress > Import completed, you can start to import the PST file into Microsoft 365.

  • Select the checkbox in front of the Import Job, e.g., stephenhunter
  • Click on Import to Office 365 icon
Import to Office 365
  • Select No, I want to import everything
  • Click Next
  • Click on Submit

Upload to the cloud succeeded.

  • Click Done
Upload of the job to the cloud succeeded

The status of the import job shows Import in progress, so you must wait until all the data has been imported. It’s not possible to force the PST import into Microsoft 365.

Note: The PST import can take one hour to complete. You can safely close the Microsoft Purview window and wait until the import completes.

9. Verify PST import job status completed

You can verify that the PST import job is completed.

  • Click on the Import Job (e.g. stephenhunter) from the list view

It shows Status completed and all Items imported.

Verify PST import job status completed and all items imported

You should find all the emails and folders you created to verify the PST imported correctly into Outlook.

  • Folder and subfolder
  • Inbox old email
Inbox Outlook imported PST file

This is how you successfully import a PST file into Microsoft 365.

Read more: Export Microsoft 365 users licenses »

Conclusion

You learned how to import a PST file into Microsoft 365 mailbox. Using the Azure Explorer Tool and Microsoft Purview compliance portal is an excellent way to import PST files into Microsoft 365 mailboxes. It’s faster than importing the PST into each Outlook user.

Did you enjoy this article? You may also like Reset MFA for Microsoft 365 user. Don’t forget to follow us and share this article.

Export Microsoft 365 mailbox to PST file

$
0
0

You need to export the Microsoft 365 mailbox and create a PST file to save the old email data. The best way to do this migration is to use the Microsoft Purview compliance portal and export the Microsoft 365 mailbox to PST. We will use the free Microsoft eDiscovery tool when exporting Microsoft 365 mailboxes to PST files. This article will teach you to export Microsoft 365 mailbox to a PST file.

Export PST file from Microsoft 365 using eDiscovery

Export Microsoft 365 mailbox to a PST file by following the below steps.

1. Assign eDiscovery Administrator role group

The administrator has the Global admin role in the organization. But they don’t have the permission to export the mailboxes. To get access, you need to check if the permissions are set. Otherwise, we need to add them to the role group eDiscovery Manager.

Set the permissions in the compliance portal:

Permissions and Roles eDiscovery Manager
  • Click on eDiscovery Manager from the list
Role groups for Microsoft Purview
  • Check if There’s no assigned member
  • Click Edit
Microsoft Purview eDiscovery Manager

It will ask which eDiscovery Manager you want to include, but we don’t need to choose any users.

Note: An eDiscovery Manager can only view and edit cases to limited cases. An eDiscovery Administrator can view and edit all cases regardless of permissions.

  • Click Next
Choose eDiscovery Manager member

Next, we will add the administrator account for the eDiscovery Administrator role group.

  • Click Choose users
Choose eDiscovery Administrator manager and role permissions
  • Find and select the administrator account from the list
  • Click Select
Choose Admin user as eDiscovery Administrator in Microsoft Purview
  • Click Next
Choose Admin user as eDiscovery Administrator in Microsoft Purview
  • Check if there are Roles in the role group eDiscovery Manager
  • Check you assigned the administrator account to eDiscovery Administrator.
  • Click Save
Assign the administrator account to eDiscovery Administrator

You successfully updated the role group.

Ssuccessfully updated the role group in Microsoft Purview

Note: Once you save, the changes can take up to 24 hours to apply. Most of the time, it will work within 1 hour.

In this step, we will search for the exchange mailbox.

  • Go back to Microsoft Purview
  • Click on Content search
  • Click Search > New search
Export Microsoft 365 mailbox to PST content search
  • Add the mailbox Name (e.g. Amanda Hansen mailbox)
  • Click Next
Add new content search Exchange mailbox
  • Turn the switch On for Exchange mailboxes
  • Click on Choose users, groups, or teams
Choose users in new content search Microsoft Purview
  • Search for the Exchange mailbox if needed
  • Select the mailbox
  • Click Done
Select exchange mailbox in new content search Microsoft Purview
  • Click Next
Select exchange mailbox in new content search Microsoft Purview
  • Click Next again
New content search conditions Microsoft Purview
  • Click Submit
Submit content search Microsoft Purview

New search created.

  • Click Done
New search created in Microsoft Purview

In the next step, we will import the PST file.

3. Export Microsoft 365 mailbox to PST file

In the Content search list, you will see the name you created in the previous step.

  • Click on the name
Export Microsoft 365 mailbox to PST content search created

You will see that the Status search is completed.

Export Microsoft 365 mailbox to PST search completed
  • Click on Actions
  • Click Export results
Export Microsoft 365 mailbox to PST

Select the output options that you like to have.

  • Select All items, excluding ones that have unrecognized format, are encrypted, or weren’t indexed for other reasons
  • Select One PST file for each mailbox
  • Click Export
Export Microsoft 365 mailbox to PST

A job has been created.

  • Click OK
A job has been created in Microsoft Purview

4. Download Microsoft 365 mailbox PST file

The last step is to download the Microsoft 365 PST file.

  • Click on the Export tab
  • Click on the name of the export job
Export Microsoft 365 mailbox to PST
  • Click Copy to clipboard
  • Then click Download results
Export Microsoft 365 mailbox to PST

The application can’t start if you are not using a Microsoft browser, and you will see the below warning.

Warning: You must use Microsoft Edge or Internet Explorer to download search results or reports. Please switch to one of these browsers to download the content.

Install Microsoft Office 365 eDiscovery Export Tool

If the tool still doesn’t start, read the Microsoft documentation You can’t start the eDiscovery PST Export Tool.

  • Install the Microsoft Office 365 eDiscovery Export Tool

eDiscovery Export Tool opens.

  • Paste the export key that you copied in the previous step
  • Browse and select a location path for the PST file
  • Click Start
eDiscovery Export Tool

Wait until the status shows The download completed successfully.

  • Click Close
eDiscovery Export Tool download completed successfully

Find the PST file in the location path you selected. In our case, it is C:\PST. Open the Exchange folder, and you will find the .pst file.

Export Microsoft 365 mailbox to PST in folder

Change PST file size export limit

The default PST file size export limit is 10 GB when you use the eDiscovery Export Tool. So if you export a PST larger than 10 GB, the tool will split the pst file into sequentially-numbered files. So if your file is 25 GB, it will split the PST file into 3 files, where the first 2 files are 10 GB and the last 5 GB.

Note: If you export a PST file larger than the desired maximum file size limit, the eDiscovery Export Tool will split the PST file into sequentially-numbered files.

You can change the default 10 GB PST file export size.

Follow the steps on the computer where you run the eDsicovery Export Tool to export PSTs.

1. Close the eDiscovery Export tool

2. Run the app Registry Editor as administrator

3. Create the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Exchange\Client\eDiscovery\ExportTool

4. Right-click in the folder to create a new String value of 20 GB for the PST export file size limit

PstSizeLimitInBytes=21474836480

5. Change the String value for the desired maximum file size limit to export a PST file. The below table shows all the sample values you can use.

Size in GBSize in bytes
1 GB1073741824
5 GB5368709120
10 GB10737418240
15 GB16106127360
20 GB21474836480

You did successfully export a Microsoft 365 mailbox to a PST file.

Read more: Manage user mailbox with PowerShell »

Conclusion

You learned how to export Microsoft 365 mailbox to a PST file. First, assign the administrator account to the eDiscovery Administrator role group. Next, create a new content search to export Microsoft 365 mailbox results. As last, download the PST file to your computer with the eDiscovery Export Tool. Remember, that the default PST export file size is 10 GB, but you can always change the size limit in Registry Editor.

Did you enjoy this article? You may also like to Reset MFA for Microsoft 365 user. Don’t forget to follow us and share this article.

Manage Microsoft 365 clutter using PowerShell

$
0
0

Manage the clutter feature in Microsoft 365 by using Exchange PowerShell. The mail items are not deleted but removed from the inbox mail folder to let users focus on important mail items.

Microsoft 365 clutter feature

Clutter is a feature in Outlook that moves less important emails out of your inbox and keeps you focused on what’s most important to you. We will show you how to enable and disable clutter for all users with PowerShell.

Connect to Exchange Online PowerShell

To be able to run the PowerShell commands specified in the current article, you will need to Connect to Exchange Online PowerShell.

Start Windows PowerShell as administrator and run the cmdlet Connect-ExchangeOnline.

Connect-ExchangeOnline

1. Enable clutter for mailboxes or mailboxes

Enable clutter for a specific mailbox

PowerShell command syntax:

Set-Clutter -Identity -Enable $True

PowerShell command example:

Set-Clutter -Identity "John@o365info.com" -Enable $True

Bulk enable clutter for all mailboxes

Bulk enable clutter for all mailboxes that don’t use clutter

PowerShell command example:

$AllMailboxes = Get-MailBox -ResultSize Unlimited -Filter '(RecipientTypeDetails -eq "UserMailbox")' | Where-Object { (Get-Clutter -Identity $_.UserPrincipalName).IsEnabled -eq $False }

ForEach ($Mailbox in $AllMailboxes) {
    Set-Clutter -Identity $Mailbox.UserPrincipalName -Enable $True
}

Bulk enable clutter for all user mailboxes

PowerShell command example:

Get-Mailbox -ResultSize Unlimited | Set-Clutter -Enable $True

2. Display information about clutter settings

Display clutter settings for a specific mailbox

PowerShell command syntax:

Get-Clutter -Identity | Select-Object IsEnabled,MailboxIdentity

PowerShell command example:

Get-Clutter -Identity "John@o365info.com" | Select-Object IsEnabled,MailboxIdentity

Display clutter settings for all mailboxes (Bulk mode)

PowerShell command example:

$Results = @()

$AllMailboxes = Get-MailBox -Filter '(RecipientTypeDetails -eq "UserMailbox")'

ForEach ($Mailbox in $AllMailboxes) {

    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
}

$Results | Select-Object Recipient,ClutterEnabled

Display mailboxes with Clutter Disabled

PowerShell command example:

$Results = @()

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  | Where-Object { (Get-Clutter -Identity $_.alias).IsEnabled -eq $False }

ForEach ($Mailbox in $AllMailboxes) {

    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
}
$Results | Select-Object Recipient,ClutterEnabled

Display mailboxes with Clutter Enabled

PowerShell command example:

$Results = @()

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  | Where-Object { (Get-Clutter -Identity $_.alias).IsEnabled -eq $True }

ForEach ($Mailbox in $AllMailboxes) {

    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
}
$Results | Select-Object Recipient,ClutterEnabled

Display Clutter folder with number of items and size

PowerShell command example:

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  
ForEach ($Mailbox in $AllMailboxes) {
    ForEach-Object { Get-MailboxFolderStatistics –Identity $Mailbox.UserPrincipalName } | Where-Object { $_.Name –Like "Clutter" } | Format-List Identity, ItemsInFolder, FolderSize
}

3. Disable mailbox clutter in Microsoft 365

Disable clutter for a single mailbox

PowerShell command syntax:

Set-Clutter -Identity -Enable $False

PowerShell command example:

Set-Clutter -Identity "John@o365info.com" -Enable $False

Bulk disable clutter for all user mailboxes

PowerShell command example:

Get-Mailbox -ResultSize Unlimited | Set-Clutter -Enable $False

4. Export information about clutter settings

Export clutter settings for a single mailbox to CSV file

PowerShell command example:

Get-Clutter -Identity "John@o365info.com" | Export-Csv "C:\TEMP\John Cluter settings.CSV" –NoTypeInformation -Encoding UTF8

PowerShell command example:

$Results = @()

$AllMailboxes = Get-MailBox -Filter '(RecipientTypeDetails -eq "UserMailbox")'

ForEach ($Mailbox in $AllMailboxes) {
    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
    $ExportData = $Results
}
$Results | Select-Object Recipient,ClutterEnabled

$ExportData | Export-Csv "C:\TEMP\Clutter settings ALL mailboxes.CSV" –NoTypeInformation -Encoding UTF8

Export mailboxes with clutter disabled to CSV file

PowerShell command example:

Results = @()

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  | Where-Object { (Get-Clutter -Identity $_.alias).IsEnabled -eq $False }

ForEach ($Mailbox in $AllMailboxes) {
    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
    $ExportData = $Results
}
$Results | Select-Object Recipient,ClutterEnabled

$ExportData | Export-Csv "C:\TEMP\ALL mailboxes - Clutter Disabled.CSV" –NoTypeInformation -Encoding UTF8

Export mailboxes with clutter enabled to CSV file

Results = @()

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  | Where-Object { (Get-Clutter -Identity $_.alias).IsEnabled -eq $True }

ForEach ($Mailbox in $AllMailboxes) {
    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
    $ExportData = $Results
}
$Results | Select-Object Recipient,ClutterEnabled

$ExportData | Export-Csv "C:\TEMP\ALL mailboxes - Clutter Enabled.CSV" –NoTypeInformation -Encoding UTF8

Export clutter folder number of items and size

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  
$MailboxFolderStatisticsClutter =
ForEach ($Mailbox in $AllMailboxes) {
    ForEach-Object { Get-MailboxFolderStatistics –Identity $Mailbox.UserPrincipalName } | Where-Object { $_.Name –Like "Clutter" } | Format-List Identity, ItemsInFolder, FolderSize
}

$MailboxFolderStatisticsClutter | Export-Csv "C:\TEMP\Clutter Folder - Number of mail items and size.CSV" –NoTypeInformation -Encoding UTF8

5. Use Exchange Online rule to bypass Clutter

When using clutter option, the Exchange server who manages the user mailbox, “decide” according to an internal algorithm to “move” (or not to “move”) a specific E-mail message to the clutter folder.

In some scenarios, the clutter algorithm can decide to classify E-mail messages as an E-mail that will be sent to the clutter folder, and we would like to override this decision.

To be able to “inform” Exchange server that we would like to prevent that clutter process for specific mail items, we can create an Exchange Online rule.

The Exchange rule is implemented by defining the characters of these specific emails, and asks Exchange to add a specific mail field to the E-mail message header.

This special mail filed is named X-MS-Exchange-Organization-BypassClutter.

We will need to add this mail field, and set the value of this mail field to “true”

For example:

X-MS-Exchange-Organization-BypassClutter = true

If Exchange Server “locates” this mail field, it “understands” that it needs to Bypass the clutter process.

The Exchange rule can be created manually or via PowerShell.

In the following section, we review two examples of such an Exchange rule that will bypass the clutter of specific mail items.

Create Exchange rule that will bypass the clutter for E-mail that include a specific text in the mail SUBJECT

PowerShell command example:

New-TransportRule -Name -SubjectContainsWords "" -SetHeaderName "X-MS-Exchange-Organization-BypassClutter" -SetHeaderValue "true"

PowerShell command example:

New-TransportRule -Name "Bypass Clutter – Subject important" -SubjectContainsWords "important" -SetHeaderName "X-MS-Exchange-Organization-BypassClutter" -SetHeaderValue "true"

Create Exchange rule that will bypass clutter for E-mail that sent from a specific SENDER

PowerShell command syntax:

New-TransportRule -Name -From "" -SetHeaderName "X-MS-Exchange-Organization-BypassClutter" -SetHeaderValue "true"

PowerShell command example:

New-TransportRule -Name "Bypass Clutter – E-mail from Bob" -From Bob@o365info.com -SetHeaderName "X-MS-Exchange-Organization-BypassClutter" -SetHeaderValue "true"

Convert user mailbox to shared mailbox

$
0
0

If you want multiple users to access the same mailbox, without paying a license because it is under 50 GB, it’s best to have a shared mailbox instead. There are three ways to convert a user mailbox to shared mailbox. In this article, you will learn how to convert a user mailbox to a shared mailbox in Exchange Admin Center (EAC), Microsoft Admin Center, and PowerShell.

User mailbox vs. shared mailbox

Let’s explain the main differences between a user and a shared mailbox.

User mailbox:

  • Paid license
  • Sign in with your credentials

Shared mailbox:

  • Free license under 50 GB of storage
  • Multiple users accessible (25 persons recommended)
  • Sign in with a user account that has access permission

Note: If you want to store more than 50 GB, you must have Exchange Online plan 2 license assigned to the shared mailbox. And if you need the online archive, you need to assign the Exchange Online plan 1 license to it.

Convert user to shared mailbox in Exchange Admin Center

From December 2022, Microsoft announced that the classic Exchange Admin Center will be depreciated. Therefore, Microsoft recommends using the new EAC. We want to show you the steps to convert the user mailbox to a shared mailbox in the new Exchange Admin Center (EAC).

Note: The user mailbox must have an Exchange Online license assigned before you can convert it to a shared mailbox. Otherwise, you won’t see the option to convert the mailbox. If you’ve removed the license, you must add it back to convert the mailbox.

Follow the steps below to convert a regular user mailbox to a shared mailbox in EAC:

  1. Sign in to Exchange Admin Center
  2. Click on Recipients > Mailboxes
  3. Select the user mailbox you want to convert
  4. Click Others
  5. Select Convert to shared mailbox
  1. Click Confirm
Convert mailbox from regular to shared confirm Exchange Admin Center

The mailbox is being converted from a regular to a shared mailbox. You successfully converted the mailbox!

Note: After converting the user mailbox to a shared mailbox, you can remove the license from the user’s account.

To verify that you converted to a shared mailbox, navigate to EAC > Recipients > Mailboxes. Click on the user, and you will see Shared mailbox under the user name.

Convert user to shared mailbox verify in Exchange admin center

Convert user to shared mailbox in Microsoft 365 Admin Center

Follow the steps below to convert a regular user to a shared mailbox in Microsoft 365 Admin Center:

  1. Sign in to Microsoft 365 Admin Center
  2. Click on Users > Active users
  3. Select the user mailbox you want to convert
  4. Click Mail
  5. Click Convert to shared mailbox
Convert user mailbox to shared mailbox in Microsoft 365 admin center
  1. Click Convert
Convert user to shared mailbox in Microsoft 365 admin center Confirm

To verify that you successfully converted the user to a shared mailbox, navigate to Microsoft 365 admin center > Teams & groups > Shared mailboxes. Find the user in the shared mailboxes list.

Verify in Microsoft 365 admin center user to shared convert

Use PowerShell to convert user to shared mailbox

Another option to convert a user to a shared mailbox is with PowerShell. Before you start, you need to Install Exchange Online PowerShell module.

1. Use the below command to Connect to Exchange Online PowerShell.

Connect-ExchangeOnline

We will use the -Type parameter with the Shared value to make it a shared mailbox type.

2. Use the below PowerShell command to convert a user mailbox to shared mailbox. Type in the name of the user mailbox.

Set-Mailbox "Amanda Hansen" -Type Shared

You can also use the same PowerShell command and type the user’s email address instead.

Set-Mailbox "Amanda.Hansen@m365info.com" -Type Shared

3. To check that you converted this user to a shared mailbox in PowerShell, you can run the Get-Mailbox cmdlet, including the mailbox name.

Get-Mailbox -Identity "Amanda Hansen" | Format-Table Name, RecipientTypeDetails

Or use the below PowerShell command to verify you converted and type the mailbox email address.

Get-Mailbox -Identity "Amanda.Hansen@m365info.com" | Format-Table Name, RecipientTypeDetails

The PowerShell output shows that you successfully converted to a shared mailbox.

Note: Always double-check the licenses to see if they are correctly set, as you don’t need a license for a shared mailbox under 50 GB of storage.

PS C:\> Get-Mailbox -Identity "Amanda.Hansen@m365info.com" | Format-Table Name, RecipientTypeDetails

Name          RecipientTypeDetails
----          --------------------
Amanda Hansen SharedMailbox

Which of the three options did you use to convert a user mailbox to a shared mailbox?

Read more: Manage Office 365 Shared Mailbox with PowerShell »

Conclusion

You learned how to convert a user mailbox to a shared mailbox in three ways. It’s possible to do this in the Exchange Admin Center (EAC), Microsoft 365 admin center, or PowerShell Exchange Online. A shared mailbox doesn’t require having licenses, so remember to remove licenses or double-check them after you convert.

Did you enjoy this article? You may also like Bulk create shared mailboxes with PowerShell. Don’t forget to follow us and share this article.

Find Microsoft 365 tenant domain name

$
0
0

There are times that you want to find the Microsoft tenant name. It can be difficult to locate your organization’s primary domain name because there are many settings in the Microsoft portal. This article will show you how to find your tenant domain name in Microsoft 365 and Microsoft Azure Active Directory (AAD).

Tenant domain name in Microsoft 365 admin center

Time needed: 5 minutes.

Follow the steps below to find your organization’s domain name in Microsoft 365 admin center.

  1. Go to Microsoft 365 admin center

    Enter your admin credentials and sign in.

  2. Open the portal menu

    Click on Show All.

  3. Expand Settings

    Click on Settings.

  4. Click on Domains

    It shows a list of all domain names. Find your tenant domain name with onmicrosoft.com at the end.

Note: When you sign in to Microsoft 365 admin center, you can search for domains. This will take you to the exact location.

Organization name in Microsoft Azure AD

We will show you the steps to find the primary domain name of your organization in Microsoft Azure AD.

  1. Sign in Azure AD portal
  2. Click Menu > Azure Active Directory
Find Microsoft 365 tenant domain name in Azure Active Directory
  1. Click Custom domain names

You will find a list of domain names. Your organization domain name ends with onmicrosoft.com.

Find Microsoft 365 organization domain name in Azure Active Directory

Note: When you sign in to Microsoft Azure AD, you can type domain in the search bar. This will immediately take you to the exact location.

You did successfully find the Microsoft 365 tenant name.

Read more: Configure help desk information in Microsoft 365 »

Conclusion

You learned how to find the tenant domain name in Microsoft 365 admin center and Azure AD. Now, you can easily locate your Microsoft 365 organization name anytime.

Did you enjoy this article? You may also like Rotate DKIM keys in Microsoft 365. Don’t forget to follow us and share this article.


Change Microsoft 365 tenant display name

$
0
0

The organization name is what the users will see on the sign-in page. If your organization has an old domain tenant name or wants to rebrand itself, it’s best to change it. You can rename the primary domain name of your organization. In this article, you will learn how to change the tenant display name in Microsoft 365 admin center and Azure AD.

Change organization name in Microsoft 365 admin center

Time needed: 5 minutes.

Follow the steps to change your organization name in Microsoft 365 admin center.

  1. Go to Microsoft 365 admin center

    Fill in your admin credentials and sign in Microsoft 365 admin center.

  2. Expand Settings

    Click on Settings.

  3. Click Org settings

    Select Org settings.

  4. Click Organization profile

    Select the Organization profile tab.

  5. Select Organization information

    Click Organization information to open the pane.

  6. Change tenant name

    Rename your organization name and fill all the required fields with asterisks (*).

  7. Click Save

    Save the organization information.

Note: You must wait a few minutes for the new name to get updated.

Rename tenant display name in Azure AD

Follow the below steps to rename the tenant display name in Azure Active Directory.

  1. Sign in Azure AD portal
  2. Click Menu > Azure Active Directory
Change Microsoft 365 tenant display name in Azure Active Directory
  1. Select Properties
  2. Rename the tenant Name
  3. Click Save
Change Microsoft 365 tenant display name in Azure AD

You did successfully change the Microsoft 365 tenant display name.

Read more: Configure technical contact details in Microsoft 365 »

Conclusion

You learned how to change the tenant display name in Microsoft 365 admin center and Azure AD. It is better to rename the organization if it has rebranded itself or does not want to use the old name anymore.

Did you enjoy this article? You may also like Rotate DKIM keys in Microsoft 365. Don’t forget to follow us and share this article.

Enable or disable Exchange ActiveSync mailboxes

$
0
0

You can easily enable or disable ActiveSync for all users and export a list of all mailboxes, including their ActiveSync status, to a single CSV file. In this article, you will learn how to enable or disable Exchange ActiveSync mailboxes in the Exchange admin center (EAC) and with Exchange Online PowerShell.

Exchange ActiveSync access to mailboxes in Exchange Server

Exchange ActiveSync enables mobile phone users to access their email, calendar, contacts, and tasks. Moreover, it allows users to retrieve this information even while working offline.

By default, ActiveSync is enabled for new user mailboxes. However, disabling ActiveSync on a mailbox restricts users from synchronizing their mailbox with a mobile device through ActiveSync.

We will show you two ways to enable or disable Exchange ActiveSync access for a mailbox:

  • Exchange admin center (EAC)
  • Exchange Online PowerShell

Enable or disable ActiveSync mailbox in Exchange admin center

Time needed: 10 minutes.

How to enable or disable Exchange ActiveSync in Exchange admin center (EAC)

  1. Go to Exchange admin center

    Fill in your admin credentials and sign in Exchange admin center.

  2. Click Menu > Recipients

    Expand Recipients.

  3. Go to Mailboxes

    Click on Mailboxes.

  4. Search and select the user mailbox

    Select a user mailbox from the list to open the display pane.

  5. The user mailbox display pane opens

    Under the General tab, click on Manage email apps settings.

  6. Disable Mobile (Exchange ActiveSync)

    Select the toggle next to Mobile (Exchange ActiveSync).

  7. Email app settings updated successfully

    Click Save and close the display pane.

You can change the ActiveSync for every single mailbox. To apply these changes to multiple mailboxes, read the next step.

Bulk enable or disable ActiveSync mailboxes in EAC

Follow the below step to bulk enable or disable Exchange ActiveSync mailboxes:

  1. Sign into Exchange admin center
  2. Click Recipients > Mailboxes
  3. Select multiple users from the mailbox list

Note: Select multiple mailboxes by clicking on the dot in front of each mailbox. You can also hold the Ctrl key and click on the name of each mailbox you want to change. To select a list of mailboxes after each other, you must hold the Shift key and click on the first mailbox and the last mailbox.

Enable or disable Exchange ActiveSync mailboxes in bulk Exchange admin center
  1. Click on Edit > App settings
Enable or disable Exchange ActiveSync mailboxes in bulk Exchange admin center
  1. The display pane opens. Click the drop-down arrow next to Mobile (Exchange ActiveSync). Select Enable or Disable. The changes will be applied to the selected mailboxes.
  1. Click Save. You will get a notification message > Email app settings updated successfully. Close the display pane.
Enable or disable Exchange ActiveSync mailboxes in bulk Exchange admin center

Enable or disable ActiveSync mailbox with PowerShell

To be able to run the PowerShell commands, you will need to Connect to Exchange Online PowerShell.

1. Start Windows PowerShell as administrator and run the Connect-ExchangeOnline cmdlet.

Connect-ExchangeOnline

We will use the Set-CASMailbox cmdlet to configure settings for Exchange ActiveSync.

2. Run the below PowerShell command to enable ActiveSync for a single user mailbox.

Set-CASMailbox -Identity "Amanda.Hansen@m365info.com" -ActiveSyncEnabled $True

3. Run the below PowerShell command to disable ActiveSync for a single user mailbox.

Set-CASMailbox -Identity "Amanda.Hansen@m365info.com" -ActiveSyncEnabled $False

Bulk enable or disable ActiveSync for all mailboxes

To enable or disable ActiveSync for the entire organization, we will use the Get-Mailbox cmdlet.

1. Bulk enable Exchange ActiveSync mailboxes for the organization with the below PowerShell command.

Get-Mailbox -ResultSize Unlimited | Set-CASMailbox -ActiveSyncEnabled $True

2. Run the below PowerShell command to bulk disable Exchange ActiveSync mailboxes for the entire organization.

Get-Mailbox -ResultSize Unlimited | Set-CASMailbox -ActiveSyncEnabled $False

Bulk enable or disable ActiveSync for users in a group

Let’s say that you have created groups in your organization. When you have a group of members in your organization, you can enable or disable Exchange ActiveSync for all these users in the group.

1. Run the below PowerShell command example to enable ActiveSync for the Sales Team.

$groupId = "Sales Team"
$members = Get-UnifiedGroup -Identity $groupId | Get-UnifiedGroupLinks -LinkType Members

foreach ($member in $members) {
    $smtpAddress = $member.PrimarySmtpAddress
    $casMailbox = Get-CASMailbox -Identity $smtpAddress -ErrorAction SilentlyContinue

    if ($casMailbox -ne $null -and -not $casMailbox.ActiveSyncEnabled) {
        Set-CASMailbox -Identity $smtpAddress -ActiveSyncEnabled $true
        Write-Host "ActiveSync enabled for user: $smtpAddress"
    }
}

Note: All the members in the group need to have a license. It will not enable ActiveSync for any member without a license.

ActiveSync enabled for user: Brenda.Smith@m365info.com
ActiveSync enabled for user: David.Kent@m365info.com
ActiveSync enabled for user: Susan.Brown@m365info.com

You can also bulk disable ActiveSync for the users in a group of your organization.

2. Use the below PowerShell command example to disable ActiveSync for the Sales Team.

$groupId = "Sales Team"
$members = Get-UnifiedGroup -Identity $groupId | Get-UnifiedGroupLinks -LinkType Members

foreach ($member in $members) {
    $smtpAddress = $member.PrimarySmtpAddress
    $casMailbox = Get-CASMailbox -Identity $smtpAddress -ErrorAction SilentlyContinue

    if ($casMailbox -ne $null -and $casMailbox.ActiveSyncEnabled) {
        Set-CASMailbox -Identity $smtpAddress -ActiveSyncEnabled $false
        Write-Host "ActiveSync disabled for user: $smtpAddress"
    }
    elseif ($casMailbox -eq $null) {
        Write-Host "User $smtpAddress does not have a license."
    }
    else {
        Write-Host "ActiveSync is already disabled for user: $smtpAddress"
    }
}

Note: All the members in the group need to have a license. It will not disable ActiveSync for any user mailbox without a license.

ActiveSync disabled for user: Brenda.Smith@m365info.com
ActiveSync disabled for user: David.Kent@m365info.com
ActiveSync disabled for user: Susan.Brown@m365info.com

Bulk enable or disable ActiveSync for multiple users

There is another way to enable or disable Exchange ActiveSync for multiple users, but you need the users’ mailbox names.

1. Use the below PowerShell command example to enable ActiveSync for multiple user mailboxes.

$users = "Brenda.Smith@m365info.com", "Chris.Lucas@m365info.com", "David.Kent@m365info.com", "Diana.Baker@m365info.com"
foreach ($user in $users) {
    Set-CASMailbox -Identity $user -ActiveSyncEnabled $True
}

2. Use the below PowerShell command example to disable ActiveSync for multiple user mailboxes.

$users = "Brenda.Smith@m365info.com", "Chris.Lucas@m365info.com", "David.Kent@m365info.com", "Diana.Baker@m365info.com"
foreach ($user in $users) {
    Set-CASMailbox -Identity $user -ActiveSyncEnabled $False
}

Enable or disable ActiveSync with CSV file

To enable or disable the ActiveSync of user mailboxes, you need to create a single CSV file.

Open Notepad and type the below data to enable ActiveSync:

  1. Type User at the top
  2. Type a list of the user mailboxes

The below picture is an example of how your CSV file should look like.

Enable Exchange ActiveSync mailboxes CSV
  1. Name the file EnableActiveSync.csv in C:\temp
  2. Save as type All files (*.*)
  3. Click Save

You will see the Notepad CSV file in your folder.

Enable Exchange ActiveSync mailboxes CSV

To ensure that PowerShell can read the file, run the Import-Csv cmdlet.

Import-Csv "C:\temp\EnableActiveSync.csv"

Run the below PowerShell script to enable ActiveSync for selected user mailboxes from a CSV file.

Import-Csv "C:\temp\EnableActiveSync.csv" | foreach {Set-CASMailbox -Identity $_.User -ActiveSyncEnabled $True}

You can also disable ActiveSync with a CSV file.

Create a CSV file in Notepad:

  1. Type User at the top
  2. Type a list of user mailboxes you want to disable ActiveSync
Disable Exchange ActiveSync mailboxes CSV
  1. Name the file DisableActiveSync.csv and save type as All files (*.*) in the C:\temp

You will see the Notepad CSV file in the same folder as the one you created before.

Disable Exchange ActiveSync mailboxes CSV

Run the below PowerShell script to disable ActiveSync for selected user mailboxes from a CSV file.

Import-Csv "C:\temp\DisableActiveSync.csv" | foreach {Set-CASMailbox -Identity $_.User -ActiveSyncEnabled $False}

Verify Exchange ActiveSync access to mailboxes

To verify you enabled or disabled Exchange ActiveSync, go to Exchange admin center > Recipients > Mailboxes. You must click on each user mailbox to check whether ActiveSync is enabled or disabled.

Or you can use the below PowerShell example to display ActiveSync for a single mailbox.

Get-CASMailbox -Identity "Amanda.Hansen@m365info.com" | ft Displayname, ActiveSyncEnabled

The PowerShell output shows the below result.

PS C:\> Get-CASMailbox -Identity "Amanda.Hansen@m365info.com" | ft Displayname, ActiveSyncEnabled

DisplayName   ActiveSyncEnabled
-----------   -----------------
Amanda Hansen             False

To check and display all Exchange mailboxes with their ActiveSync status, you must use PowerShell.

Get-CASMailbox -ResultSize Unlimited | ft DisplayName,ActiveSyncEnabled

The PowerShell output shows a list of ActiveSync enabled (True) or disabled (False) of all mailboxes.

PS C:\> Get-CASMailbox -ResultSize Unlimited | ft DisplayName,ActiveSyncEnabled

DisplayName              ActiveSyncEnabled
-----------              -----------------
Amanda Hansen                        False
Brenda Smith                         False
Chris Lucas                          False
David Kent                           False
Diana Baker                          False
Discovery Search Mailbox              True
George Wilson                         True
Info Box                              True
Jill Bates                           False
Julia Wood                            True
Kelly Test                            True
Mary James                            True
Project Pool 11                       True
Projector 21                          True
Projector 8                           True
René Gibs                            False
Room01                                True
RoomTest8                             True
Stephen Hunter                        True
Susan Brown                          False

Export list ActiveSync mailboxes to CSV

You can also export ActiveSync data of all mailboxes to a single CSV file. This way, you can easily search ActiveSync for all mailboxes.

Use the below PowerShell example command:

Get-CASMailbox -ResultSize Unlimited | Select-Object DisplayName,ActiveSyncEnabled | Export-Csv "C:\temp\Export ActiveSync.csv" -Encoding UTF8 -NoTypeInformation

Once you export the information, you can find the CSV file in the C:\temp folder.

Open the CSV file with an application like Microsoft Excel to see the results.

Export CSV Enable or disable Exchange ActiveSync mailboxes

That’s it!

Read more: Manage user mailbox with PowerShell »

Conclusion

You learned how to enable or disable Exchange ActiveSync to mailboxes in Exchange admin center (EAC) and Exchange Online PowerShell. In EAC, you can bulk enable or disable ActiveSync for all users. With PowerShell, you can also export a list of all mailboxes and their ActiveSync status to a single CSV file.

Did you enjoy this article? You may also like to Increase and improve Azure MFA security. Don’t forget to follow us and share this article.

Assign Microsoft 365 licenses with group-based licensing in Azure

$
0
0

There is no need to manually assign or remove licenses for each user in Microsoft 365 admin center. Instead, an easier way to assign licenses for multiple users is with groups. In this article, you will learn how to assign Microsoft 365 licenses using group-based licensing in Azure AD (AAD).

Group-based licensing Azure AD

Once you create a group with users in Azure AD, you can assign one or more product licenses. All the members of the group will have the same licenses assigned. Azure AD applies the same licenses when you add new members to a group. And when a member leaves a group, their licenses are automatically removed.

This licensing method eliminates using PowerShell to manage licenses for individual users based on organizational or department structure changes. It makes the process of assigning and removing licenses for multiple users at once more efficient.

Read more information about What is group-based licensing in Azure Active Directory?

Group-based licensing requirements

To use group-based licensing, every user must have one of the following licensing:

  • Paid or trial subscription for Azure AD Premium P1 and above.
  • Paid or trial edition of Microsoft 365 Business Premium, Office 365 Enterprise E3 or Office 365 A3 or Office 365 GCC G3, Office 365 E3 for GCCH, or Office 365 E3 for DOD and above.

Create new group with members in Azure AD

We will create a group to assign the default Microsoft 365 licenses to all users. Then we will create another group to add paid Microsoft 365 licenses (e.g., Power BI or Visio) for certain users.

Follow the steps to create a new group, including members in Azure:

  1. Sign in to Microsoft Azure portal
  2. Click on Menu > Azure Active Directory
Assign Microsoft 365 licenses with group-based licensing in Azure AD
  1. Click Groups
Assign Microsoft 365 licenses with group-based licensing in Azure groups
  1. Click New group
Assign Microsoft 365 licenses with group-based licensing in Azure new group
  1. Select Security
  2. Enter the name of the group > M365_E5_Default
Assign Microsoft 365 licenses with group-based licensing in Azure security group

You can add members before and after you create the group. In our example, we will add members before creating the group.

  1. Click No members selected
  2. Search for users
  3. Click the user to add a member
  4. Click Select when you selected all users

Note: When you select users, notice that only the first 50 results are shown. Use the search bar to get more specific results.

Assign Microsoft 365 licenses with group-based licensing in Azure add members
  1. Click Create
Assign Microsoft 365 licenses with group-based licensing in Azure

Note: You need to refresh the page to see the new group you created in the list.

Now we will create a new group to assign other (paid) licenses to a few members. Follow the same steps as shown above to create a new group.

In our example, we named the group M365_E5_EXO_P2 and selected 5 members.

Assign Microsoft 365 licenses with group-based licensing in Azure AD

Go to AAD > Groups > All groups to find the two security groups you created. The next step is to assign licenses to each group in Azure AD.

Assign Microsoft 365 licenses with group-based licensing in Azure AD

Assign Microsoft 365 licenses to group in Azure AD

Time needed: 10 minutes.

We will show you how to assign Microsoft 365 licenses to a group in Azure AD.

  1. Go to Azure AD portal.

    Sign in to Microsoft Azure with your admin credentials.

  2. In the portal menu.

    From the portal menu, click on Azure Active Directory.

  3. You will be redirected to the Overview page.

    Click on Groups.

  4. Open the group you created.

    Click on the security group type from the list.

  5. Assign a new license to the group.

    Click on Licenses.

  6. Select Assignments.

    Click on Assignments.

  7. Select licenses to assign to the group.

    Select licenses Microsoft 365 E5 Developer. Choose the license services for the group.

  8. Click Save.

    Click Save and close the license screen.

  9. License assignments succeeded.

    Wait a few minutes for the license changes to apply to all users.

There is another way to assign licenses to a group. You can follow the same steps we showed above or learn another way.

Follow the steps to assign licenses to the other group we created:

  1. Go to Azure Active Directory
  2. Click Licenses > All products
  3. Select the checkbox Microsoft 365 E5 Developer
  4. Click Assign
Assign Microsoft 365 licenses with group-based licensing in Azure
  1. Click Add users and groups
  2. Search and select M365_E5_EXO_P2
  3. Click Select
Assign Microsoft 365 licenses with group-based licensing in Azure
  1. Click on the tab Assignment options or below Next: Assignment options >
Assign Microsoft 365 licenses with group-based licensing in Azure
  1. Select the assignment options you want to include
  2. Click Next: Review + assign >

Note: For the other group, you can only include paid licenses such as Microsoft Power BI or Microsoft Visio.

Assign Microsoft 365 licenses with group-based licensing in Azure
  1. Click Assign

You will get a notification that the licenses are assigned to the group.

Assign Microsoft 365 licenses with group-based licensing in Azure

Verify group-based licensing in Azure AD

Verify you created a security group type with licensed users in AAD.

Follow the below steps to find the group-based licensing:

  1. Go to Azure Active Directory > Licenses
  2. Click All products
  3. Click on the license Microsoft 365 E5 Developer

You can see that we assigned 20 members with the license Microsoft 365 E5 Developer. In our example, 15 members of the group M365_E5_Default have all the license options, and 5 members from the group M365_E5_EXO_P2 have 1 license option (Exchange Online Plan 2) assigned.

  1. Click on Licensed users

You will find a list of all the users with the Microsoft 365 E5 Developer license. Some users can have multiple licenses assigned, as you can see in the below picture.

Note: Some users have assigned the Microsoft 365 E5 Developer license manually (Direct), and some through the group-based licensing (Inherited).

Assignment paths Direct and Inherited licensed users

Note: You can remove the direct license assignment from each user. To remove the inherited license, you must remove the user from the group.

  1. Click on Licensed groups

It shows that the State is Active for both groups. The Enabled Services show how many services of the license (57/57) you assigned. For the group M365_E5_EXO_P2, we have only assigned the Exchange Online Plan 2 license (1/57).

Assign Microsoft 365 licenses with group-based licensing in Azure

You successfully assigned Microsoft 365 licenses with group-based licensing in Azure AD!

Read more: Configure Certificate Based Authentication to run automated PowerShell scripts »

Conclusion

You learned how to assign Microsoft 365 licenses with group-based licensing in Azure AD. It’s easier to bulk assign Microsoft 365 licenses to all users when creating groups in AAD. This way, you can find and manage your users’ licenses.

Did you enjoy this article? You may also like Export Microsoft 365 users licenses. Don’t forget to follow us and share this article.

Set Employee ID for all Azure users with PowerShell

$
0
0

It’s faster to set Employee ID for Azure AD users with PowerShell when connecting to McGraph correctly. In this article, you will learn how to get and set Employee ID for all Azure Active Directory users. We will also show you to export bulk users Employee IDs to a single CSV file.

Connect to McGraph

1. First, you need to install the Microsoft Graph PowerShell module. It is also recommended to install PowerShell 7 version on Windows.

2. Open Windows PowerShell as administrator and run the below cmdlet.

Connect-MgGraph -Scope User.ReadWrite.All

3. The sign-in to your account window opens, where you choose your admin account and enter the password. Then click on Sign in.

Set employee ID for all Azure users with PowerShell

If you have enabled MFA, you will get a verification code sent as a text message or to your Authentication app on your phone. If your MFA is disabled, you will not do anything here.

Now you must go back to the PowerShell windows where you will see this output.

PS C:\> Connect-MgGraph -Scope User.ReadWrite.All
Welcome To Microsoft Graph!

4. By default, the module uses the Microsoft Graph REST API v1.0. To get the EmployeeId, you must run the Select-MgProfile command (beta version).

Select-MgProfile -Name "beta"

Now you are ready to get and set the EmployeeId of all Azure users with PowerShell commands.

Get one user Employee ID

Get the EmployeeID information of a single user by running the below PowerShell command.

Get-MgUser -UserId "Brenda.Smith@m365info.com" | fl employee*

The PowerShell output shows the EmployeeId of a single user.

EmployeeHireDate      : 
EmployeeId            : 2
EmployeeLeaveDateTime : 
EmployeeOrgData       : Microsoft.Graph.PowerShell.Models.MicrosoftGraphEmployeeOrgData
EmployeeType          : 

It shows that the user Brenda Smith has an EmployeeId 2.

Set one user Employee ID

Let’s say that we want to change the Employee ID of a single user. In our example, we want to change the EmployeeId of Brenda Smith to number 22.

1. Run the below PowerShell command to get the UserId of a single user.

Get-MgUser -UserId "Brenda.Smith@m365info.com"

The PowerShell output in our example will look like this.

PS C:\> Get-MgUser -UserId "Brenda.Smith@m365info.com"

Id                                   DisplayName  Mail                      UserPrincipalName         UserType
--                                   -----------  ----                      -----------------         --------
d912b0fc-6f7e-4ec2-a9e4-854ed27a511a Brenda Smith Brenda.Smith@m365info.com Brenda.Smith@m365info.com Member  

2. Copy the Id from your output and use it in the below PowerShell syntax. Then, type the new EmplopyeeId number you want to set.

Update-MgUser -UserId "Id number" -EmployeeId "new number"

3. Run the PowerShell command to change the EmployeeId of a single user. In our example, we want to change the EmployeeId of Brenda Smith to number 22.

Update-MgUser -UserId d912b0fc-6f7e-4ec2-a9e4-854ed27a511a -EmployeeId "22"

4. Verify you updated the EmployeeId of this single user.

Get-MgUser -UserId "Brenda.Smith@m365info.com" | fl EmployeeId

The PowerShell output shows the updated EmployeeId of this single user. In our example, we set a new EmployeeId 22 for Brenda Smith.

PS C:\> Get-MgUser -UserId "Brenda.Smith@m365info.com" | fl EmployeeId

EmployeeId : 22

You correctly set a new Employee ID for a single user. Next, we will show you how to get all users’ EmployeeId.

Bulk get users Employee ID

To get bulk users Employee ID, run the below PowerShell command.

Get-MgUser -All | ft UserPrincipalName, Displayname, EmployeeId

The PowerShell output shows the below result.

PS C:\> Get-MgUser -All | ft UserPrincipalName, Displayname, EmployeeId

UserPrincipalName           DisplayName     EmployeeId
-----------------           -----------     ----------
admin@m365info.com          M365info Admin            
Amanda.Hansen@m365info.com  Amanda Hansen   1         
Brenda.Smith@m365info.com   Brenda Smith    2         
Chris.Lucas@m365info.com    Chris Lucas     3         
David.Kent@m365info.com     David Kent      4         
Diana.Baker@m365info.com    Diana Baker     5         
George.Wilson@m365info.com  George Wilson             
haji1@m365info.com          Haji                      
InfoBox@m365info.com        Info Box                  
infoRESTORE@m365info.com    Room01                    
Jill.Bates@m365info.com     Jill Bates                
JuliaRESTORE@m365info.com   Julia Wood                
KellyTest@m365info.com      Kelly Test                
Ken.Walker@m365info.com     Ken Walker                
Mary.James@m365info.com     Mary James                
msadmin@m365info.com        M365info Admin            
newuser@m365info.com        New User                  
Projector11@m365info.com    Project Pool 11           
Projector21@m365info.com    Projector 21              
Projector8@m365info.com     Projector 8               
Rene.Gibs@m365info.com      René Gibs                 
Ricky.Lewis@m365info.com    Ricky Lewis               
RoomTest8@m365info.com      RoomTest8                 
Stephen.Hunter@m365info.com Stephen Hunter            
Susan.Brown@m365info.com    Susan Brown  

Export bulk users Employee ID to CSV file

You can export all Azure users’ Employee IDs to a single CSV file. This way, you can easily search which Employee ID number each user has.

Run the below PowerShell command to export bulk users’ EmployeeId to a CSV file.

Get-MgUser -All | Select-Object UserPrincipalName, DisplayName, EmployeeId | Export-Csv -Path "C:\temp\EmployeeId Users.csv" -NoTypeInformation -Encoding UTF8

You will find the CSV file in the C:\temp folder. Open the CSV file with an application like Microsoft Excel to see the results.

Set employee ID for all Azure users with PowerShell

You can successfully get and set Employee ID for all Azure users with PowerShell!

Read more: Manage user mailbox with PowerShell »

Conclusion

You learned how to set Employee ID for all Azure users with PowerShell. It’s important to connect to McGraph correctly to get and set an Employee ID for a single user. You can also get bulk users’ Employee IDs and export all information to a CSV file.

Did you enjoy this article? You may also like Create unlimited Client Secret in Azure AD. Don’t forget to follow us and share this article.

Bulk create Azure AD users with CSV file

$
0
0

Most organizations want to create multiple users at once to save time. Therefore, you must create a CSV file with all the new users and upload it into the Azure AD portal. In this article, you will learn how to bulk create users in Azure AD with CSV file.

Create CSV file

You need to download and save the BulkCreateUsers.csv file.

The CSV file includes the following values:

  • Row 1: Contains the version number and must be included in the upload CSV.
  • Row 2: Includes all the column headings. The format of the column headings looks like e.g., Name [displayName] Required.
  • Examples row: In the CSV file, we have included examples of acceptable values for each column. You must remove the row’s contents and replace the examples with your entries.

Requirements when you fill in the CSV file:

  • Do not remove or modify the first two rows of the BulkCreateUsers.csv file, or the upload can’t be processed.
  • Do not add new columns to the CSV file.
  • You must fill in the required columns with data.
  • Ensure no extra whitespace exists before or after any field, such as UserPrincipalName.

In the next step, we will show you how to edit the CSV file with an application like Microsoft Excel.

Edit CSV file in Excel

To save the Excel file as CSV comma delimited, you need to make Excel use a comma for the list separator.

  1. Open Microsoft Excel
  2. Click Options
Edit Bulk create user CSV file in Microsoft Excel

In the Excel Options, you need to make some changes:

  1. Click Advanced
  2. Under Editing options > Clear System separators
  3. Set Decimal separator to period (.)
  4. Set Thousands separator to comma (,)
  5. Click OK
Edit Bulk create user CSV file in Microsoft Excel

Note: Close the Microsoft Excel application to save the changes.

  1. Open the CSV file in Microsoft Excel and fill in the required data

Once you finish the required data, save the file as .csv.

  1. Name the file
  2. Save it as a CSV (Comma delimited) file
  3. Click Save

In the next step, we will show you how to upload the CSV file in Azure AD.

Bulk create Azure AD users with CSV file

Time needed: 10 minutes.

How to bulk create users in Azure AD with CSV file.

  1. Go to Azure AD portal.

    Sign in to Microsoft Azure with your admin credentials.

  2. In the portal menu.

    From the portal menu, click on Azure Active Directory.

  3. You will be redirected to the Overview page.

    Click on Users.

    Bulk create users in Azure AD

  4. You will be redirected to the Users preview.

    Click on Bulk operations > Bulk create.

    Bulk operations create users in Azure AD

  5. Upload your CSV file.

    Browse the CSV file in your folder.

    Bulk create users in Azure Active Directory

  6. Select your CSV file.

    Select the CSV file you created.

    Bulk create users CSV file

  7. File uploaded successfully.

    Click Submit.

    Bulk create users csv file submit in Azure AD.

  8. View the status of bulk operation results.

    Bulk operation in progress and succeeded.

You will get a notification when the bulk operation is completed.

Check Azure AD users bulk results

To see if the bulk operation succeeded, follow the below steps:

  1. Go to Azure Active Directory > Users
  2. Click Bulk operation results
  3. Click on the File name BulkCreateUsers.csv

The status shows Completed with no errors.

Bulk create users in Azure AD

It shows a list of all the new Azure users. The status shows Success for all 5 users we created in bulk.

Bulk create users operation results in Azure AD

Verify all users in Azure AD

Find the newly created users in Azure:

  1. Go to the Azure Active Directory > Users
  2. Select All users (preview)

All the new users you created in bulk are in the same list as the others. It also updates the total number of users (29). In our case, we bulk created 5 new users, and we started with 24 users.

Bulk create users operation results in Azure AD

That’s it!

Note: Another way to bulk create Azure AD users is with PowerShell. Read more in the article Create Azure AD Users from CSV with PowerShell.

Keep reading: Import PST file into Microsoft 365 »

Conclusion

You learned how to bulk create users in Azure Active Directory (AAD) with a CSV file. Now you can create multiple users for your organization in no time by uploading a CSV file into the Azure AD portal.

Did you enjoy this article? You may also like Assign Microsoft 365 licenses with group-based licensing in Azure. Don’t forget to follow us and share this article.

Configure Catch all Mailbox in Microsoft 365

$
0
0

The catch all mailbox is a special mailbox that receives all the email messages that were sent to non-existing organization recipients. A catch all mailbox is an excellent solution to find out which messages are sent to your organization but were not received by the recipients. In this article, you will learn to configure catch all mailbox in the Exchange admin center (EAC).

Catch all mailbox in Exchange Online

The catch all mailbox in your Exchange Online server can benefit your organization. A catch-all mailbox collects any emails addressed to non-existent email addresses within the domain instead of bouncing them back to the sender as undeliverable. The catch-all mailbox routes any email sent to a non-existent or misspelled email address within the domain. This feature is particularly useful in preventing the loss of legitimate emails due to typos or misconfiguration.

An excellent way to understand the catch all mailbox is with an example outlined below.

Let’s say that the manager of our HR department has the following email address Amanda.Hansen@m365info.com. If someone sends an email message to this address Amanda.Heinz@m365info.com, the mail server (Exchange Online) will reject this message. The mail server will reply with a non-delivery report (NDR) to notify the source sender that there is no such recipient and that it could not deliver the message.

Microsoft sends a How to Fix It template in the NDR message.

Email message did not deliver NDR

To avoid the above scenario, you can configure the catch all mailbox that will accept all these email messages.

The Exchange administrator or another organization user will have access permission to that specific catch all mailbox. From time to time, they can look into the catch all mailbox and check for legitimate mail that was supposed to be sent to a specific recipient organization.

Catch all mailbox risks

The catch all mailbox is not a supported solution by Microsoft 365. Therefore, Microsoft has not published formal information about the catch all mailbox feature. It’s to avoid the fact that the catch all mailbox can increase spam emails in Microsoft 365 mail server.

Note: Exchange Online does not have the catch-all mailbox feature enabled by default.

Note: It’s important to understand that the catch all mailbox can’t be used or implemented in an Exchange Hybrid environment. But only on a “cloud only” environment, meaning the organization’s mail infrastructure is hosted only by Exchange Online, and no other mail infrastructure is involved.

Authoritative vs. Internal Relay domain

Before we go through the steps, let’s explain why you must change the domain default settings from Authoritative to Internal Relay.

When we register our public domain name in Microsoft 365, it’s considered an accepted domain. For this accepted domain, you can choose between two different authorities:

  • Authoritative: Email is delivered only to valid recipients in this Exchange organization. All email for unknown recipients is rejected.
  • Internal Relay: Email is delivered to recipients in this Exchange organization or relayed to an email server at another physical or logical location.

By default, the accepted domain is set to Authoritative. It means that the Exchange Online server has the authority of this accepted domain.

When someone sends an email from a registered public domain to a recipient’s email address, the Exchange Online server will first look into the Global Address List (GAL). Exchange automatically creates this built-in list and includes every mail-enabled object in the Active Directory.

Note: If the recipient’s email address does not appear in the GAL, the Exchange Online server will reply with an NDR message. It will inform the source sender that the recipient does not exist.

Internal Relay

To share the authority with the Exchange Online server and another mail server, you must configure Internal Relay for your accepted domain.

If someone sends an email from a registered public domain to a recipient’s email address, the Exchange Online server will go through the recipient list (GAL).

Note: If the recipient’s email address does not appear in the GAL, the Exchange Online server will forward the mail to the other mail server.

Transport rule

Each time Exchange Online gets a request for delivering an email message to a non-existing Exchange Online recipient, it will look for the other mail infrastructure MX records by default.

To change this behavior, we must set up a transport rule in Exchange Online that will enforce Exchange Online to deliver the email message to the designated catch all mailbox.

How to configure catch all mailbox in Exchange Online

To configure the catch all mailbox in Exchange admin center (EAC), we need to follow these steps:

  1. Create a shared mailbox to catch all mailbox
  2. Create a dynamic distribution group
  3. Change accepted domain from Authoritative to Internal Relay
  4. Create an Exchange Online transport rule

Step 1. Create shared mailbox

The first step is to create a shared mailbox to use as the catch all mailbox. It is better to receive the non-existing emails of your domain in one mailbox.

We recommend creating a shared mailbox because of the following reasons:

  • There are no licenses required
  • Share with other members
  • Assign Send as or Full Access permissions

If you already have a shared mailbox you want to use as the catch all mailbox, then you can skip this step.

Create a shared mailbox in Exchange admin center:

  1. Sign in to Exchange admin center
  2. Click Recipients > Mailboxes
  3. Click Add a shared mailbox
  4. Type Display name Catch All
  5. Type Email address Catch.All
  6. Select Domain m365info.com
  7. Click Create
Create shared mailbox

Note: You will get a notification saying the shared mailbox was created. It may take a few minutes before you can add members. Close the pane.

Add members and assign permissions to the created shared mailbox:

  1. Click on the created shared mailbox (Catch All) from the list
  2. Select Delegation
  3. Go to Read and manage (Full Access) > Click Edit
assign full access permission shared mailbox
  1. Click Add members
Add member to shared mailbox
  1. Select users
  2. Click Save
  1. Click Confirm
  2. Close the pane

A notification will show that the mailbox permissions and selected users were added successfully. The changes are saved and will appear within minutes.

If you want to add Send as permission to users in the shared mailbox, you can follow the steps shown above.

Step 2. Create dynamic distribution group

The next step is to create a dynamic distribution group including all the existing organization recipients. This is to let the catch all mailbox understand which email addresses already exist within the organization domain.

Create a dynamic distribution group in EAC:

  1. Sign in to Exchange admin center
  2. Click Recipients > Groups
  3. Click Add a group
Create a dynamic distribution group in Exchange admin center

Choose a group type.

  1. Select Dynamic distribution
  2. Click Next
Create a dynamic distribution group in Exchange admin center

Set up the basics.

  1. Fill in the Name, e.g., All Microsoft 365 recipients
  2. Click Next
Create a dynamic distribution group in Exchange admin center to catch all mailbox

Assign users.

  1. Select All recipient types
  2. Click Next
Create a dynamic distribution group in Exchange admin center

Edit settings.

  1. Type the email address
  2. Select the domain
  3. Click Next
Create a dynamic distribution group in Exchange admin center

Review and finish adding the group.

  1. Click Create group
Create a dynamic distribution group in Exchange admin center

The group All Microsoft 365 recipients is created, but it isn’t ready to use yet.

  1. Click Close
Create a dynamic distribution group in Exchange admin center

Note: It might take up to two hours to prepare the group for use.

Step 3. Convert domain to Internal Relay

Convert the accepted domain default settings from Authoritative to Internal Relay by following the steps below.

  1. Go to the Exchange admin center
  2. Click Mail flow > Accepted domains
  3. Click on the default domain
Mail flow accepted domains internal relay

The accepted domain (m365info.com) pane opens.

  1. Select Internal Relay
  2. Select Allow mail to be sent from this domain
  3. Click Save
Internal Relay and Allow mail to be sent from this domain

You can see that the accepted default domain type has changed to Internal Relay.

Note: An organization with multiple public domain names in Microsoft 365 will need to change the default settings from Authoritative to Internal Relay to each of the domains separately.

Mail flow accepted domains internal relay

To configure the catch all mailbox, we need to create a new rule in the next step.

Step 4. Create mail flow transport rule

Time needed: 15 minutes.

Create a new transport rule in Exchange admin center.

  1. Go to the Exchange admin center

    Click Mail flow > Rules
    Click Add a rule
    Select Create a new rule

    Catch all Mailbox transport rule

  2. Set rule conditions

    Type the name Catch all rule

    Catch all transport rule Exchange admin center

  3. Apply this rule if

    Select > The sender
    Select > is external/internal

    Apply this rule if the sender is external/internal

  4. Select sender location

    Select > Outside the organization
    Click Save

    Select sender location outside the organization

  5. Do the following

    Select > Redirect the message to
    Select > these recipients

    Do the following Redirect the message to these recipients

  6. Select members

    Search and select the created shared mailbox from the list
    Click Save

    Catch all rule shared mailbox

  7. Except if

    Select > The recipient
    Select > is a member of this group

    Except if the recipient is a member of this group

  8. Select members

    Select the created dynamic distribution group > All Microsoft 365 recipients
    Click Save

    Catch all mailbox rule recipients

  9. Name and set conditions for your transport rule results

    Click Next

    Set mail flow transport rule conditions

  10. Set rule settings

    Leave the default settings & click Next

    Set mailflow transport rule settings

  11. Review and finish

    Click Finish

    Review and finish mail transport rule

  12. Transport rule created successfully

    Click Done to close the pane

    Transport rule created successfully

The transport rule is disabled by default. Therefore you must go to the Catch all rule you created. Select the new rule and set the toggle to Enabled. Wait a few minutes to update the changes.

Catch All transport rule enabled

You did configure the catch all mailbox rule, but we need to check if the catch all mailbox configuration works in the next step.

Verify catch all mailbox configuration

Email a non-existing recipient from the internal domain m365info.com.

Important: Give it 15 minutes before you test the Catch all mailbox rule, as it needs time to propagate the changes in the Exchange Online environment.

In our example, we will use Amanda’s (Amanda.Morgan@m365info.com) to send an email message to the following email address: Unknown456@m365info.com.

verify sent to catch all mailbox

You can see the email Amanda sent to the non-existing recipient Unknown456@m365info.com, but it was redirected and delivered to the Catch All shared mailbox.

When we open the folder Catch All > Inbox, we see the email message was delivered. Even though the email address did not belong to anyone from the recipient list (GAL), the email message was sent with the help of the mail flow transport rule.

verify sent to catch all mailbox

The below table shows where your email will be received if an internal (organization domain) or external (Hotmail, Gmail, or other domain) email address sends it.

FromToReceive
Internal Existing email addressExisting recipient
InternalNon-existing email addressCatch all shared mailbox
ExternalExisting email addressExisting recipient
ExternalNon-existing email addressCatch all shared mailbox

You did successfully configure the catch all mailbox rule in Exchange admin center!

Read more: Enable reply all storm protection in Exchange Online »

Conclusion

You learned how to configure a catch all mailbox for your organization in Exchange admin center. It solves the problem of missing important emails because of spelling errors. Remember that this is not a solution for every organization, as it can cause an increase in spam emails. But it’s an excellent way to control every message sent to the organization that didn’t reach the recipient’s mailbox.

Did you enjoy this article? You may also like Rotate DKIM keys in Microsoft 365. Don’t forget to follow us and share this article.

How to simulate spam mail

$
0
0

After you set up a third-party spam filter in your organization or configure adjustments in Exchange Online, you want to check if the spam detection works. The best way to test your existing mail security infrastructure is to send spam mail and analyze the content. In this article, you will learn how to simulate spam mail.

Introduction to simulating spam mail

In a modern mail environment, it is important to implement some security mechanism that will protect your mail infrastructure from spam mail and other threats.

Exchange Online Protection (EOP) is a cloud-based filtering service that protects your organization against spam, malware, and other email threats. EOP is included in all Microsoft 365 organizations with Exchange Online mailboxes.

If you want to implement a mail security gateway, you need to know if your mail security gateway is functioning correctly and what will happen otherwise.

So we will define a specific rule where our mail security gateway recognizes spam mail and sends a notification to a designated recipient.

How to simulate spam mail

We will show an example where user A (outside organization) sends a spam email message to recipient B (inside organization).

In our case, a user with a Gmail account will send spam mail to a recipient (Stephen.Hunter@m365info.com) in our organization.

Stephen has a user mailbox hosted in Microsoft 365 (Exchange Online server).

Note: To simulate the scenario of spam mail, the sender and the recipient must be recipients from different organizations. So you can’t test the spam mail option if the sender and the destination recipient belong to the same Microsoft 365 tenant, because the verification check is not implemented by the EOP server.

1. Send spam mail

You can easily create an email message that our system will identify as spam, and the implementation of simulating spam mail is straightforward.

All you need to do is create an email message that includes a predefined text string and send it to the destination recipient, which is protected by the mail security gateway.

The Apache SpamAssassin organization has developed a special procedure to implement this clever trick.

Follow the steps below to send spam mail:

  • Copy the following text string below
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
  • Paste the text string in the mail body
  • Send the email message to the recipient (Stephen.Hunter@m365info.com)
Send simulate spam mail

2. Receive spam mail

In the below picture, you can see the Outlook mail of Stephen.Hunter@m365info.com. When you open the Junk Email folder, you can find the email message you sent.

In a Microsoft 365 environment, the component that serves as a mail security gateway is the EOP (Exchange Online Protection) server. The EOP server examines and checks each email message sent to a Microsoft 365 recipient.

When the email message reaches the recipient’s mailbox, it will automatically be sent to the Junk Email folder because of the high value of the SCL.

how to simulate spam mail in junk email folder

3. View mail message header content

You need to understand how the Microsoft 365 EOP server stamps specific email messages as spam mail. In an Exchange based environment, the method for classifying email messages as spam is by defining a particular value in the SCL parameter.

EOP recognizes the text string in the email message and classifies the email message as spam mail by setting the value of the SCL (Spam Confidence Level).

See the below table that explains the SCL.

SCLDefinition
-1Skipped spam filtering.
0, 1Spam filtering determined the message wasn’t spam.
5, 6Spam filtering marked the message as spam.
8, 9Spam filtering marked the message as high confidence spam.
2, 3, 4, and 7Not used by spam filtering.

When the email message reaches the recipient mailbox, because of the high value of the SCL, the mail will be sent to the Junk Email folder.

View the information of the mail header

To be able to see the information that is included in the email message, we will be using the OWA mail client. We will fetch the content of the mail header of the spam mail sent to Stephen.

  • Open the specific email message
  • Click on the three dots to open a selection pane
  • Select View > View message details
View message details of simulate spam mail

It shows the content of the specific mail header.

  • Select the content of the mail header
  • Copy the content by right-clicking and choose Copy (CTRL + C)
Copy content mail header simulate spam mail

In the next step, we will use the copied content to analyze it.

4. Check with Microsoft Message Header Analyzer

We want to show how to use the Microsoft Message Header Analyzer for analyzing the mail header content. Of course, there are a couple of other free web-based tools that we can use to analyze a mail header.

Message Header Analyzer in Microsoft Remote Connectivity Analyzer

In the below picture, you can see the different mail fields included within the mail header.

  • Go to the specific mail field header > Forefront Antispam Report Header
  • Look for the Spam Confidence Level

In this field, the Spam Confidence Level value of the email message is in our example 6. Indicating that the EOP (Exchange Online Protection) server has classified the email message as spam.

You can also find the SCL:6 in the Source header.

Spam Confidence Level in Forefront Antispam Report Header

That’s it!

Read more: Enable reply all storm protection in Exchange Online »

Conclusion

You learned how to simulate spam mail to test your organization’s spam filter. After you send and receive the spam mail, you can analyze it in the Microsoft Message Header Analyzer. The email message will display the Spam Confidence Level (SCL) classified as spam.

Did you enjoy this article? You may also like Reset MFA for Microsoft 365 user. Don’t forget to follow us and share this article.


Get-MessageTrace in Exchange Online

$
0
0

With the Get-MessageTrace PowerShell cmdlet, you can view information on each mail sent and received in Exchange Online in the last 10 days. You can also export information about all incoming and outgoing mails saved in Exchange Online. In this article, you will learn how to use the Exchange Online PowerShell Get-MessageTrace cmdlet.

Exchange Online message trace

In an Exchange Online (Microsoft 365) based environment, Exchange Online registers every incoming and outgoing mail.

There are two ways to view information on mail sent and received:

  • Exchange admin center
  • Exchange Online PowerShell

In this article, we will only use Exchange Online PowerShell and go through the PowerShell commands Get-MessageTrace and Get-MessageTraceDetail to query and export messages data.

Let’s start listing the advantages and disadvantages of the Get-MessageTrace PowerShell command.

Advantage:

  • To view and export information of Exchange Online messages.
  • Quickly and effectively retrieve information about messages registered in Exchange Online.

Disadvantages:

  • You can obtain information from the Exchange Online server within a maximum time range of 10 days. Exchange Online saves mail information for a period of 90 days, but you can’t fetch information that exceeds 10 days.
  • The information you can display on the PowerShell console or export to a file is very basic information that doesn’t include detailed information about the specific mail.

Note: Use the Get-MessageTraceDetail PowerShell cmdlet to get additional information for the last 10 days. However, the information is still basic, and the results are returned less quickly.

If you require information about a mail older than 10 days, use the PowerShell command Get-HistoricalSearch. Especially when searching for detailed information about a specific mail registered in Exchange Online.

Connect to Exchange Online PowerShell

To be able to run the PowerShell commands, you need to run Windows PowerShell as administrator and connect to Exchange Online PowerShell.

Connect-ExchangeOnline

After you connect, proceed to the next step.

Get-MessageTrace PowerShell cmdlet

The Get-MessageTrace PowerShell cmdlet can trace messages in Exchange Online.

The date range is an essential component when using the Get-MessageTrace PowerShell cmdlet. We will also show various types of examples to the user of Get-MessageTrace with different parameters and filters such as sender, recipient, subject, IP address, and more.

Date range

The most essential building block is the date range. Therefore it’s best to use a PowerShell parameter that defines the date range.

Note: When using the Get-MessageTrace command, you can only get data from the last 48 hours by default.

These PowerShell parameters define the required date range:

  • StartDate
  • EndDate

After we provide the information about the required date range, we can add additional blocks that help us to filter or narrow the search results.

We will show you some examples to narrow the search results:

  • Get information about mails related to emails sent from a specific sender or to a specific recipient.
  • Get information about mails related to emails with a specific subject or a specific status.
Get-MessageTrace command building blocks

Sender vs. Recipient

In many scenarios, we filter or narrow the Get-MessageTrace PowerShell command result by adding filter parameters.

The filter parameters sender and recipient can be confusing, so it’s important to clarify the meaning of these terms.

  • Sender: The person that sends the email message.
  • Recipient: The person that receives the email message. It is related to the destination entity to which the email was sent.

The below picture shows an example of when Bob sends an email to Adele. Bob is defined as the sender (SenderAddress), and Adele is the recipient (RecipientAddress).

Use Exchange Online PowerShell Get-MessageTrace sender and recipient

If you want to get information about all the available PowerShell parameters when using the Get-MessageTrace cmdlet, you can use the Get-Member PowerShell command in the next step.

Use Get-MessageTrace PowerShell command

Run the below PowerShell command example.

Get-MessageTrace | Get-Member

You will get the below PowerShell output example. Look at the different parameters listed under Name.

PS C:\> Get-MessageTrace | Get-Member

   TypeName: Deserialized.Microsoft.Exchange.Management.FfoReporting.MessageTrace

Name             MemberType Definition                                                                                                                                                               
----             ---------- ----------                                                                                                                                                               
GetType          Method     type GetType()                                                                                                                                                           
ToString         Method     string ToString(), string ToString(string format, System.IFormatProvider formatProvider), string IFormattable.ToString(string format, System.IFormatProvider formatPro...
EndDate          Property   System.DateTime {get;set;}                                                                                                                                               
FromIP           Property   System.String {get;set;}                                                                                                                                                 
Index            Property   System.Int32 {get;set;}                                                                                                                                                  
MessageId        Property   System.String {get;set;}                                                                                                                                                 
MessageTraceId   Property   System.Guid {get;set;}                                                                                                                                                   
Organization     Property   System.String {get;set;}                                                                                                                                                 
Received         Property   System.DateTime {get;set;}                                                                                                                                               
RecipientAddress Property   System.String {get;set;}                                                                                                                                                 
SenderAddress    Property   System.String {get;set;}                                                                                                                                                 
Size             Property   System.Int32 {get;set;}                                                                                                                                                  
StartDate        Property   System.DateTime {get;set;}                                                                                                                                               
Status           Property   System.String {get;set;}                                                                                                                                                 
Subject          Property   System.String {get;set;}                                                                                                                                                 
ToIP             Property    {get;set;} 

Run the PowerShell cmdlet Get-MessageTrace without parameters to show data from the last 48 hours.

Get-MessageTrace

PowerShell output result.

PS C:\> Get-MessageTrace

Received            Sender Address                 Recipient Address              Subject                                                                                         Status        
--------            --------------                 -----------------              -------                                                                                         ------        
15/06/2023 19.45.30 Stephen.Hunter@m365info.com    amanda.hansen@m365info.com     RE: مرحبا كيف حالك                                                                                 Delivered     
15/06/2023 19.42.43 Amanda.Hansen@m365info.com     stephen.hunter@m365info.com    مرحبا كيف حالك                                                                                     Delivered     
15/06/2023 11.54.24 info4@dienglg.top              stephen.hunter@m365info.com    If you need paper notebook,Im here for you                                                      FilteredAsSpam
14/06/2023 11.22.44 Office365Reports@microsoft.com msadmin@m365info.com           Your requested Report Amanda is now available                                                   Delivered     
14/06/2023 10.01.30 ms-noreply@microsoft.com       msadmin@m365info.com           Get the latest Office apps                                                                      Delivered     
14/06/2023 08.56.40 postmaster@m365info.com        office365reports@microsoft.com Undeliverable: Your requested Message trace report - ‎2023-06-14T08:25:07.136Z‎ is now available  Failed        
14/06/2023 08.56.39 Office365Reports@microsoft.com msadmin@m365info.com           Your requested Message trace report - ‎2023-06-14T08:25:07.136Z‎ is now available                 Failed        
14/06/2023 01.57.05 beata@defenderarchitect.com    stephen.hunter@m365info.com    Test your Junk mail!                                                                            FilteredAsSpam

To get the data of the last 10 days, proceed to the next step.

Set specific date range

As mentioned, the most basic building block when using the Get-MessageTrace command is the required date range.

The date range is the space between the start date and the end date.

Look at the below Powershell syntax example.

Get-MessageTrace -StartDate <mm/dd/yyyy> -EndDate <mm/dd/yyyy>

Exchange Online shows the information with a start date of a maximum of 10 days.

Get-MessageTrace -StartDate 04/01/2023 -EndDate 06/01/2023

If you type a start date older than 10 days from today or a date range greater than 10 days, you will get the following error.

PS C:\> Get-MessageTrace -StartDate "05/01/2023" -EndDate "05/10/2023"
Write-ErrorMessage : |Microsoft.Exchange.Management.Tasks.ValidationException|Invalid 
StartDate value. The StartDate can't be older than 10 days from today.
At C:\AppData\Local\Temp\tmpEXO_ewmxedgo.0pb\tmpEXO_ewmxedgo.0pb.psm1:1120 
char:13
+             Write-ErrorMessage $ErrorObject
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-MessageTrace], ValidationException
    + FullyQualifiedErrorId : [Server=DB9PR02MB7211,RequestId=60294da4-119d-8a23-c31c-d9a9895 
   70a3a,TimeStamp=Wed, 07 Jun 2023 20:28:34 GMT],Write-ErrorMessage

Note: You will get an error if the StartDate is older than 10 days from today. Also, the date range between the StartDate and EndDate may not exceed 10 days.

When using the Get-MessageTrace command, there are two major syntax methods that we can use for defining the date range.

  • Manually type the specific dates (Start-Date and End-Date) in the format month, day, and year (mm/dd/yyyy).
  • Or use the PowerShell cmdlet Get-Date.

The second method which we prefer to use is the PowerShell function Get-Date.

As the name implies, the Get-Date PowerShell cmdlet will fetch the information about the current date and time. The information includes the second, minute, hour, day, month, and year.

When using the Get-MessageTrace cmdlet, the Get-Date PowerShell function defines the End-Date. You can define the Start-Date by using time units such as AddHours or AddDays and subtracting them from the current date.

In the following example, we define a date range of 10 days using the time unit AddDays and the value (-10).

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -Enddate (Get-Date)

This syntax tells PowerShell that we want to define a date calculated by subtracting 10 days from the current time we get from the Get-Date PowerShell cmdlet.

Get-MessageTrace data in specific date range

Get information about sent or received emails in a specific date range. Specify the dates by manually typing the StartDate and EndDate.

Run the below PowerShell command example.

Get-MessageTrace -StartDate 06/05/2023 -EndDate 06/10/2023

PowerShell output example.

PS C:\2> Get-MessageTrace -StartDate 06/05/2023 -EndDate 06/10/2023

Received            Sender Address                             Recipient Address           Subject                                                                      Status        
--------            --------------                             -----------------           -------                                                                      ------        
09/06/2023 10.13.47 susanbernard@gmail.com                     amanda.hansen@m365info.com  This is a test                                                               Delivered     
09/06/2023 10.04.16 susanbernard@gmail.com                     stephen.hunter@m365info.com Re: Test                                                                     Delivered     
09/06/2023 10.01.37 Stephen.Hunter@m365info.com                susanbernard@gmail.com      Test                                                                         Delivered     
09/06/2023 09.58.06 Amanda.Hansen@m365info.com                 stephen.hunter@m365info.com RE: Available                                                                Delivered     
09/06/2023 09.56.06 Stephen.Hunter@m365info.com                amanda.hansen@m365info.com  Available                                                                    Delivered     
07/06/2023 21.15.32 6157142326@pcdcva.onmicrosoft.com          projectpool11@m365info.com  All parties have Completed: Please DocuSign`M365info                         FilteredAsSpam
07/06/2023 12.32.00 631752352@pcdcva.onmicrosoft.com           chris.lucas@m365info.com    All parties have Completed: Please DocuSign:`chris.lucas@m365info.com        FilteredAsSpam
07/06/2023 06.55.21 6556232315@pcdcva.onmicrosoft.com          amanda.hansen@m365info.com  All parties have Completed: Please DocuSign: M365info`                       FilteredAsSpam
06/06/2023 21.30.03 6296142354@netorgft3171689.onmicrosoft.com projector8@m365info.com     Approved: Completed: Please DocuSign: M365info`                              FilteredAsSpam
06/06/2023 20.34.22 susanbernard@gmail.com                     stephen.hunter@m365info.com Test your Junk mail!                                                         FilteredAsSpam
06/06/2023 20.25.41 susanbernard@gmail.com                     stephen.hunter@m365info.com Just a test!                                                                 Delivered     
06/06/2023 19.22.32 6226122326@netorgft3171689.onmicrosoft.com diana.baker@m365info.com    Completed: Please DocuSign - M365info 06/06/2023 12:22`                      FilteredAsSpam
05/06/2023 17.36.04 juliannaroland73@gmail.com                 kellytest@m365info.com      Good Day Beloved,                                                            FilteredAsSpam
05/06/2023 14.29.22 629572315@netorgft3171689.onmicrosoft.com  chris.lucas@m365info.com    Your document has been Completed: Please DocuSign: chris.lucas@m365info.com` FilteredAsSpam

Note: The time zone in Microsoft will be in Universal Time Coordinated (UTC). For example, the Central Standard Time (CST) is 5 hours behind UTC. So if an email were sent at 8:00 AM CST, it would show up as 13:00 PM. To ensure getting all messages of a specific date range with message trace, add or subtract the hours, depending on varying time zones of the Exchange server location and the user’s mailbox.

Next, we would like to show examples where we use the Get-Date PowerShell cmdlet as a baseline and add PowerShell time units such as AddHours, AddDays, and AddMinutes.

Get-MessageTrace data in last x minutes

Get information about sent and received emails in the last x minutes. We will show you an example of all Exchange email messages sent and received in the last 30 minutes.

Run the below PowerShell command example.

Get-MessageTrace -StartDate (Get-Date).AddMinutes(-30) -EndDate (Get-Date)

It will get Exchange Online mail information for the last 30 minutes.

PowerShell output example.

PS C:\> Get-MessageTrace -StartDate (Get-Date).AddMinutes(-30) -EndDate (Get-Date)

Received            Sender Address              Recipient Address           Subject          Status   
--------            --------------              -----------------           -------          ------   
15/06/2023 19.45.30 Stephen.Hunter@m365info.com amanda.hansen@m365info.com  RE: مرحبا كيف حالك  Delivered
15/06/2023 19.42.43 Amanda.Hansen@m365info.com  stephen.hunter@m365info.com مرحبا كيف حالك      Delivered

Note: You may not exceed the time limit of 10 days. An error occurs when you type the number 15840 and above for AddMinutes.

Get-MessageTrace data in last x hours

Get information about sent and received emails in the last x hours. The example will display all Exchange email messages sent and received in the last 30 hours.

PowerShell command example:

Get-MessageTrace -StartDate (Get-Date).AddHours(-30) -EndDate (Get-Date)

It will get Exchange Online mail information for the last 30 hours.

Powershell output example:

PS C:\> Get-MessageTrace -StartDate (Get-Date).AddHours(-30) -EndDate (Get-Date)

Received            Sender Address              Recipient Address           Subject                                     Status        
--------            --------------              -----------------           -------                                     ------        
15/06/2023 19.45.30 Stephen.Hunter@m365info.com amanda.hansen@m365info.com  RE: مرحبا كيف حالك                             Delivered     
15/06/2023 19.42.43 Amanda.Hansen@m365info.com  stephen.hunter@m365info.com مرحبا كيف حالك                                 Delivered     
15/06/2023 11.54.24 info4@dienglg.top           stephen.hunter@m365info.com If you need paper notebook,Im here for you  FilteredAsSpam

Note: You can’t exceed the time limit of 10 days, or you will get an error. Keep the number of Addhours below 264.

Get-MessageTrace data in the x days

Get information about sent and received emails in the last x days. You can display all Exchange email messages sent and received up to the last 10 days.

Run the PowerShell command example.

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date)

Note: Remember that you can’t exceed the time limit of maximum 10 days.

Date range using variables

If you want to avoid typing long and complex date values, you can use a method where you define the date range using variables.

The variables we define will contain the required date range. The Get-MessageTrace cmdlet defines the date range by using the variables defined in the previous step.

Use the below PowerShell variables.

$DateEnd = Get-Date
$DateStart = $DateEnd.AddHours(-30)
Get-MessageTrace -StartDate $DateStart -EndDate $DateEnd

PowerShell output example.

PS C:\> $DateEnd = Get-Date
$DateStart = $DateEnd.AddHours(-30)
Get-MessageTrace -StartDate $DateStart -EndDate $DateEnd

Received            Sender Address              Recipient Address           Subject                                     Status        
--------            --------------              -----------------           -------                                     ------        
15/06/2023 19.45.30 Stephen.Hunter@m365info.com amanda.hansen@m365info.com  RE: مرحبا كيف حالك                             Delivered     
15/06/2023 19.42.43 Amanda.Hansen@m365info.com  stephen.hunter@m365info.com مرحبا كيف حالك                                 Delivered     
15/06/2023 11.54.24 info4@dienglg.top           stephen.hunter@m365info.com If you need paper notebook,Im here for you  FilteredAsSpam

Get-MessageTrace clean results

When we use the Get-MessageTrace PowerShell cmdlet in Exchange Online without a specific filter, the output includes unnecessary information about systems and internal Exchange Online mail messages.

In the following example, we can see information about system emails irrelevant to our search.

PowerShell output example.

PS C:\> Get-MessageTrace -StartDate (Get-Date).AddDays(-5) -EndDate (Get-Date)

Received            Sender Address                 Recipient Address              Subject                                                                                          Status        
--------            --------------                 -----------------              -------                                                                                          ------        
15/06/2023 19.45.30 Stephen.Hunter@m365info.com    amanda.hansen@m365info.com     RE: مرحبا كيف حالك                                                                                  Delivered     
15/06/2023 19.42.43 Amanda.Hansen@m365info.com     stephen.hunter@m365info.com    مرحبا كيف حالك                                                                                      Delivered     
15/06/2023 11.54.24 info4@dienglg.top              stephen.hunter@m365info.com    If you need paper notebook,Im here for you                                                       FilteredAsSpam
14/06/2023 11.22.44 Office365Reports@microsoft.com msadmin@m365info.com           Your requested Report Amanda is now available                                                    Delivered     
14/06/2023 10.01.30 ms-noreply@microsoft.com       msadmin@m365info.com           Get the latest Office apps                                                                       Delivered     
14/06/2023 08.56.40 postmaster@m365info.com        office365reports@microsoft.com Undeliverable: Your requested Message trace report - ‎2023-06-14T08:25:07.136Z‎ is now available   Failed        
14/06/2023 08.56.39 Office365Reports@microsoft.com msadmin@m365info.com           Your requested Message trace report - ‎2023-06-14T08:25:07.136Z‎ is now available                  Failed        
14/06/2023 01.57.05 beata@defenderarchitect.com    stephen.hunter@m365info.com    Test your Junk mail!                                                                             FilteredAsSpam
13/06/2023 07.22.03 info8@dupiist.top              stephen.hunter@m365info.com    Professional Notebook manufacturer in China                                                      Delivered     
12/06/2023 20.08.19 ocampofer18@gmail.com          stephen.hunter@m365info.com    Prueba                                                                                           FilteredAsSpam
12/06/2023 14.24.28 ryan.przybyl@hds-rx.com        stephen.hunter@m365info.com    spam filter test                                                                                 FilteredAsSpam

Suppose we want to clean the search result by removing the information about the system emails. In that case, we will add filters that will ignore specific emails.

Run the below PowerShell example.

Get-MessageTrace -StartDate (Get-Date).AddDays(-5) -EndDate (Get-Date) | Where {$_.SenderAddress -notlike '*microsoft.com*' -and $_.SenderAddress -notlike '*root' }

In our example, we want to remove all the Sender Address emails with the word *microsoft.com* or a word that ends with *top.

PowerShell output example.

PS C:\> Get-MessageTrace -StartDate (Get-Date).AddDays(-5) -EndDate (Get-Date) | Where {$_.SenderAddress -notlike '*microsoft.com*' -and $_.SenderAddress -notlike '*top' }

Received            Sender Address              Recipient Address              Subject                                                                                          Status        
--------            --------------              -----------------              -------                                                                                          ------        
15/06/2023 19.45.30 Stephen.Hunter@m365info.com amanda.hansen@m365info.com     RE: مرحبا كيف حالك                                                                                  Delivered     
15/06/2023 19.42.43 Amanda.Hansen@m365info.com  stephen.hunter@m365info.com    مرحبا كيف حالك                                                                                      Delivered     
14/06/2023 08.56.40 postmaster@m365info.com     office365reports@microsoft.com Undeliverable: Your requested Message trace report - ‎2023-06-14T08:25:07.136Z‎ is now available   Failed        
14/06/2023 01.57.05 beata@defenderarchitect.com stephen.hunter@m365info.com    Test your Junk mail!                                                                             FilteredAsSpam
12/06/2023 20.08.19 ocampofer18@gmail.com       stephen.hunter@m365info.com    Prueba                                                                                           FilteredAsSpam
12/06/2023 14.24.28 ryan.przybyl@hds-rx.com     stephen.hunter@m365info.com    spam filter test                                                                                 FilteredAsSpam

Get-MessageTrace combined with Group-Object results

In some scenarios, we are not looking for information about specific email messages but rather a high-level view of mails performed by a specific sender or recipient within a specific date range.

By using the PowerShell cmdlet Group-Object in addition to the Get-MessageTrace, we can get this high-level view of emails.

Note: The Group-Object cmdlet helps us to group information about a specific property and enables us to count the number of instances in each group.

Get information about most active organization senders

In the following example, we want to accomplish the following requirements:

  • We want to get information about the emails sent from all senders in the last 10 days.
  • We want to present the results grouped by each of the senders.
  • We want to count the number of email messages sent by each sender.
  • We want to present the results in descending order to view the users who sent the most mail items at the top.

To get the required information, we use the Group-Object cmdlet that performs three tasks:

  • Group the results by relating to the property SenderAddress.
  • Count the results for each sender (the number of mail items a specific sender sent).
  • Order the information presented in the Count column in descending order.

Use the PowerShell command Group-Object syntax to sort the most active organization sender.

Group-Object -Property SenderAddress | Select Name,Count | Sort Count -Descending

Run the PowerShell command example Get-MessageTrace in combination with Group-Object.

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) | Group-Object -Property SenderAddress | Select Name,Count | Sort Count -Descending

Display information about the number of mail items (Count) accepted from specific senders (Name). The user with the most emails will be shown above.

The PowerShell output example.

PS C:\> Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) | Group-Object -Property SenderAddress | Select Name,Count | Sort Count -Descending

Name                                       Count
----                                       -----
susanbernard@gmail.com                         4
Stephen.Hunter@m365info.com                    3
Amanda.Hansen@m365info.com                     2
Office365Reports@microsoft.com                 2
info4@dienglg.top                              1
ms-noreply@microsoft.com                       1

In the example below, we want to accomplish the following requirements:

  • We want to retrieve information about each email received by our users (or sent to our users) within the last 10 days.
  • We want to present the results grouped by each recipient (RecipientAddress).
  • We want to count the number of email messages that each recipient sent.
  • We want to present the results in descending order. It displays the users who send the largest number of mail items, which are the most active recipients.

To get the required information, we use the Group-Object cmdlet that performs three tasks:

  • Group the results by relating to the property (RecipientAddress).
  • Count the results for each recipient (the number of mail items sent to the specific recipient).
  • Order the information presented in the count column in descending order.

Use the PowerShell command Group-Object syntax to sort the most popular organization recipients.

Group-Object -Property RecipientAddress | Select Name,Count | Sort Count -Descending

Run the PowerShell command example.

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) | Group-Object -Property RecipientAddress | Select Name,Count | Sort Count -Descending

It displays the number of mail items (Count) received by recipients (Name).

PowerShell output example.

PS C:\> Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) | Group-Object -Property RecipientAddress | Select Name,Count | Sort Count -Descending

Name                           Count
----                           -----
stephen.hunter@m365info.com       10
amanda.hansen@m365info.com         4
msadmin@m365info.com               3
office365reports@microsoft.com     1
susanbernard@gmail.com             1
projectpool11@m365info.com         1
chris.lucas@m365info.com           1
projector8@m365info.com            1
diana.baker@m365info.com           1

Get-MessageTrace of emails sent from specific sender

A specific sender is an organization user who sends emails to other recipients (internal & external)

Use the PowerShell parameter -SenderAddress, to obtain information about emails sent by a specific sender address.

To retrieve information about emails sent by a specific sender, you can use the following PowerShell command syntax.

Get-MessageTrace -SenderAddress <Sender Email address>

PowerShell command example.

Get-MessageTrace -SenderAddress Amanda.Hansen@m365info.com

Note: If you can’t see any results, no emails were sent from this user in the last 48 hours. By default, the Get-MessageTrace only shows data from the last 48 hours.

To get information about a specific sender in the last x days, you need to add parameters.

PowerShell command syntax.

Get-MessageTrace -StartDate (Get-Date).AddDays(-x) -EndDate (Get-Date) -SenderAddress <Sender Email address>

Run the below PowerShell command example.

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) -SenderAddress Amanda.Hansen@m365info.com

PowerShell result of a specific sender in the last 10 days.

PS C:\> Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) -SenderAddress Amanda.Hansen@m365info.com

Received            Sender Address             Recipient Address           Subject        Status   
--------            --------------             -----------------           -------        ------   
15/06/2023 19.42.43 Amanda.Hansen@m365info.com stephen.hunter@m365info.com مرحبا كيف حالك    Delivered
09/06/2023 09.58.06 Amanda.Hansen@m365info.com stephen.hunter@m365info.com RE: Available  Delivered

You can also display the number of email messages sent by a specific sender.

Get information about the number of emails (Count) sent by a specific sender within the last x days.

For this example, we will add the Group-Object cmdlet for counting the number of email messages sent by a specific sender.

PowerShell command example.

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) -SenderAddress Amanda.Hansen@m365info.com | Group-Object -Property SenderAddress | Select Name,Count

The PowerShell result shows the count of emails sent by a user.

PS C:\> Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) -SenderAddress Amanda.Hansen@m365info.com | Group-Object -Property SenderAddress | Select Name,Count

Name                       Count
----                       -----
Amanda.Hansen@m365info.com     2

Get information about emails sent by multiple senders with an email address that includes a specific domain name in the last x days.

PowerShell command syntax.

Get-MessageTrace -StartDate (Get-Date).AddDays(-x) -EndDate (Get-Date) -SenderAddress <*@Domain name>

PowerShell command example.

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) -SenderAddress *@m365info.com

Our example displays information about all the emails sent by senders with the same domain name (m365info.com) for the last 10 days.

PowerShell output result.

PS C:\> Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) -SenderAddress *@m365info.com

Received            Sender Address              Recipient Address              Subject                                                                                          Status   
--------            --------------              -----------------              -------                                                                                          ------   
15/06/2023 19.45.30 Stephen.Hunter@m365info.com amanda.hansen@m365info.com     RE: مرحبا كيف حالك                                                                                  Delivered
15/06/2023 19.42.43 Amanda.Hansen@m365info.com  stephen.hunter@m365info.com    مرحبا كيف حالك                                                                                      Delivered
14/06/2023 08.56.40 postmaster@m365info.com     office365reports@microsoft.com Undeliverable: Your requested Message trace report - ‎2023-06-14T08:25:07.136Z‎ is now available   Failed   
09/06/2023 10.01.37 Stephen.Hunter@m365info.com susanbernard@gmail.com         Test                                                                                             Delivered
09/06/2023 09.58.06 Amanda.Hansen@m365info.com  stephen.hunter@m365info.com    RE: Available                                                                                    Delivered
09/06/2023 09.56.06 Stephen.Hunter@m365info.com amanda.hansen@m365info.com     Available                                                                                        Delivered

Export email information sent from sender to CSV

Export information about emails sent from a specific sender to a file. You can create a dedicated file for each sender.

You can get information about all the mails performed by each sender that appears in Exchange Online.

The requirements that we need to fulfill include the following parts:

  • Show information about all the senders who sent emails in the last 10 days.
  • It saves and exports the information to a CSV (Comma Separated Value) file.
  • It will create and export a dedicated CSV file for each of the senders. For example, if the sender is Amanda.Hansen@m365info.com, the dedicated CSV file created for “Amanda” will include information only for emails sent from Amanda.Hansen@m365info.com.

To get the required information, we will use a PowerShell ForEach statement:

  • In the first phase, the ForEach statement will loop via the array of records in Exchange Online.
  • In the second phase, we export the required information to a separate CSV file based on the sender identity.

PowerShell command example.

$AllSender = Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) | Group-Object -Property SenderAddress | Select Name
$AllSender = $AllSender.name
$ErrorActionPreference = "SilentlyContinue"
ForEach ($Sender in $AllSender) {
    Get-MessageTrace -StartDate (Get-Date).AddDays(-3) -EndDate (Get-Date) -SenderAddress $Sender | Export-Csv "C:\temp\$sender.csv" –NoTypeInformation -Encoding UTF8
}

Get-MessageTrace of emails sent to specific recipient

The -RecipientAddress parameter lets us get information about emails sent to specific recipients.

We want to show how to get information about (internal & external) emails sent to organization recipients.

See the below PowerShell syntax.

Get-MessageTrace -RecipientAddress <Recipient Email Address>

Run the below PowerShell command example.

Get-MessageTrace -RecipientAddress Amanda.Hansen@m365info.com

Note: If you can’t see any results, no emails were sent to this recipient user in the last 48 hours. By default, the Get-MessageTrace only shows data from the last 48 hours.

You can also see information about emails sent to a specific organization recipient in the last x days. But you need to add the parameters -StartDate and -EndDate.

PowerShell command syntax.

Get-MessageTrace -StartDate (Get-Date).AddDays(-x) -EndDate (Get-Date) -RecipientAddress <Recipient Email Address>

Run the PowerShell command example.

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) -RecipientAddress Amanda.Hansen@m365info.com

PowerShell output example of emails sent to a specific organization recipient in the last 10 days.

PS C:\> Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) -RecipientAddress Amanda.Hansen@m365info.com

Received            Sender Address                    Recipient Address          Subject                                                Status        
--------            --------------                    -----------------          -------                                                ------        
15/06/2023 19.45.30 Stephen.Hunter@m365info.com       amanda.hansen@m365info.com RE: مرحبا كيف حالك                                        Delivered     
09/06/2023 10.13.47 susanbernard@gmail.com            amanda.hansen@m365info.com This is a test                                         Delivered     
09/06/2023 09.56.06 Stephen.Hunter@m365info.com       amanda.hansen@m365info.com Available                                              Delivered     
07/06/2023 06.55.21 6556232315@pcdcva.onmicrosoft.com amanda.hansen@m365info.com All parties have Completed: Please DocuSign: M365info` FilteredAsSpam

Display additional information about emails sent to a specific recipient in the last x days and count the number of emails.

For this example, we will add the Group-Object cmdlet for counting the number of emails sent to a specific recipient.

PowerShell command example.

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) -RecipientAddress Amanda.Hansen@m365info.com | Group-Object -Property SenderAddress | Select Name,Count

The PowerShell output displays a list with email senders (Name) and the number of emails (Count) sent to the recipient (Amanda.Hansen@m365info.com).

PS C:\> Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) -RecipientAddress Amanda.Hansen@m365info.com | Group-Object -Property SenderAddress | Select Name,Count

Name                              Count
----                              -----
Stephen.Hunter@m365info.com           2
susanbernard@gmail.com                1
6556232315@pcdcva.onmicrosoft.com     1

See information about emails sent to a specific recipient that includes a specific domain name in their email address in the last x days.

PowerShell command syntax

Get-MessageTrace -StartDate (Get-Date).AddDays(-x) -EndDate (Get-Date) -RecipientAddress <*@Domain Name>

In the following example, we want to get information about emails sent to all recipients with email addresses, including the domain name (m365info.com) in the last 10 days.

PowerShell command example.

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) -RecipientAddress *@m365info.com

Our example displays all the emails sent to recipients with the same domain name (m365info.com) for the last 10 days.

PowerShell output example.

PS C:\> Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) -RecipientAddress *@m365info.com

Received            Sender Address                             Recipient Address           Subject                                                                           Status        
--------            --------------                             -----------------           -------                                                                           ------        
15/06/2023 19.45.30 Stephen.Hunter@m365info.com                amanda.hansen@m365info.com  RE: مرحبا كيف حالك                                                                   Delivered     
15/06/2023 19.42.43 Amanda.Hansen@m365info.com                 stephen.hunter@m365info.com مرحبا كيف حالك                                                                       Delivered     
15/06/2023 11.54.24 info4@dienglg.top                          stephen.hunter@m365info.com If you need paper notebook,Im here for you                                        FilteredAsSpam
14/06/2023 11.22.44 Office365Reports@microsoft.com             msadmin@m365info.com        Your requested Report Amanda is now available                                     Delivered     
14/06/2023 10.01.30 ms-noreply@microsoft.com                   msadmin@m365info.com        Get the latest Office apps                                                        Delivered     
14/06/2023 08.56.39 Office365Reports@microsoft.com             msadmin@m365info.com        Your requested Message trace report - ‎2023-06-14T08:25:07.136Z‎ is now available   Failed        
14/06/2023 01.57.05 beata@defenderarchitect.com                stephen.hunter@m365info.com Test your Junk mail!                                                              FilteredAsSpam
13/06/2023 07.22.03 info8@dupiist.top                          stephen.hunter@m365info.com Professional Notebook manufacturer in China                                       Delivered     
12/06/2023 20.08.19 ocampofer18@gmail.com                      stephen.hunter@m365info.com Prueba                                                                            FilteredAsSpam
12/06/2023 14.24.28 ryan.przybyl@hds-rx.com                    stephen.hunter@m365info.com spam filter test                                                                  FilteredAsSpam
09/06/2023 10.13.47 susanbernard@gmail.com                     amanda.hansen@m365info.com  This is a test                                                                    Delivered     
09/06/2023 10.04.16 susanbernard@gmail.com                     stephen.hunter@m365info.com Re: Test                                                                          Delivered     
09/06/2023 09.58.06 Amanda.Hansen@m365info.com                 stephen.hunter@m365info.com RE: Available                                                                     Delivered     
09/06/2023 09.56.06 Stephen.Hunter@m365info.com                amanda.hansen@m365info.com  Available                                                                         Delivered     
07/06/2023 21.15.32 6157142326@pcdcva.onmicrosoft.com          projectpool11@m365info.com  All parties have Completed: Please DocuSign`M365info                              FilteredAsSpam
07/06/2023 12.32.00 631752352@pcdcva.onmicrosoft.com           chris.lucas@m365info.com    All parties have Completed: Please DocuSign:`chris.lucas@m365info.com             FilteredAsSpam
07/06/2023 06.55.21 6556232315@pcdcva.onmicrosoft.com          amanda.hansen@m365info.com  All parties have Completed: Please DocuSign: M365info`                            FilteredAsSpam
06/06/2023 21.30.03 6296142354@netorgft3171689.onmicrosoft.com projector8@m365info.com     Approved: Completed: Please DocuSign: M365info`                                   FilteredAsSpam
06/06/2023 20.34.22 susanbernard@gmail.com                     stephen.hunter@m365info.com Test your Junk mail!                                                              FilteredAsSpam
06/06/2023 20.25.41 susanbernard@gmail.com                     stephen.hunter@m365info.com Just a test!                                                                      Delivered     
06/06/2023 19.22.32 6226122326@netorgft3171689.onmicrosoft.com diana.baker@m365info.com    Completed: Please DocuSign - M365info 06/06/2023 12:22`                           FilteredAsSpam

Get-MessageTrace of emails with specific status

The parameter -Status filters the results by the delivery status of the email. Valid values for this parameter are:

  • None: The message has no delivery status because it was rejected or redirected to a different recipient.
  • Failed: Message delivery was attempted but failed, or the message was filtered as spam or malware or by transport rules.
  • Pending: Message delivery is underway or was deferred and is being retried.
  • Delivered: The message was delivered to its destination.
  • Expanded: There was no message delivery because the message was addressed to a distribution group, and the membership of the distribution was expanded.

Get information about sent or received emails with a specific status.

PowerShell command syntax.

Get-MessageTrace -StartDate <mm/dd/yyyy> -EndDate <mm/dd/yyyy> -Status <Status>

Get information about sent or received emails with a specific status in the last x days

PowerShell command syntax

Get-MessageTrace -StartDate (Get-Date).AddDays(-x) -EndDate (Get-Date) -Status <Status>

In the following example, we want to get information about incoming and outgoing emails with the -Status value Failed in the last 10 days.

PowerShell command example.

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) -Status Failed

There is another optional syntax that we can use for getting information about emails with a specific status.

PowerShell command example.

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) | Where {$_.Status -eq "Failed"}

The PowerShell output shows all emails with the Status value Failed.

PS C:\Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) | Where {$_.Status -eq "Failed"}

Received            Sender Address                 Recipient Address              Subject                                                                                          Status
--------            --------------                 -----------------              -------                                                                                          ------
14/06/2023 08.56.40 postmaster@m365info.com        office365reports@microsoft.com Undeliverable: Your requested Message trace report - ‎2023-06-14T08:25:07.136Z‎ is now available   Failed
14/06/2023 08.56.39 Office365Reports@microsoft.com msadmin@m365info.com           Your requested Message trace report - ‎2023-06-14T08:25:07.136Z‎ is now available                  Failed

Export information of emails with specific status to CSV

You can obtain information about the status of all emails sent and received within the past 10 days. Create a separate CSV file for each type of status.

The requirements that we need to fulfill include the following parts:

  • It saves and exports the information we get from the Get-MessageTrace command to a CSV (Comma Separated Value) file.
  • It will export a separate CSV file for each type of status; Delivered, Expanded, Failed, None, and Pending.

To fulfill this requirement, we will use a PowerShell ForEach statement.

  • In the first phase, the ForEach statement will loop via the array of records in Exchange Online.
  • In the second phase, we export the required information to a separate CSV file based on the specific mail status.

PowerShell command example.

$statuses = "None", "Failed", "Pending", "Delivered", "Expanded"
ForEach ($status in $statuses) {
    Get-MessageTrace -StartDate (Get-Date).Adddays(-10) -EndDate (Get-Date) -Status $status | Export-Csv "C:\temp\$status.csv" –NoTypeInformation -Encoding UTF8
}

Note: If there are no emails for a particular status, it will export an empty CSV file.

Display information regarding the number of mail items sent to Distribution Groups

In this example, we want to obtain information about email addresses sent to the Distribution Group. We use the specific status Expanded when looking for a Distribution Group. Whenever an email is sent to a Distribution Group, Exchange performs the expand operation. So we will Group the result and then Count the result.

PowerShell command example.

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) -Status Expanded | Group-Object -Property RecipientAddress | Select Name,Count | Sort Count -Descending

Note: If no data exists for the status Expanded, the PowerShell output will show nothing.

Get-MessageTrace of emails with specific subject

The Get-MessageTrace variable $Subject lets us get information about emails that include a specific subject or a specific string in the mail subject.

Let’s obtain information about emails sent and received with a specific subject in the last x days.

PowerShell command syntax.

Get-MessageTrace -StartDate <mm/dd/yyyy> -EndDate <mm/dd/yyyy> | Where {$_.Subject -like "*<string>*"}

Run the below PowerShell command example.

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) | Where {$_.Subject -like "*test*"}

Our PowerShell output example shows all the emails with the subject word *test* in the last 10 days.

PS C:\> Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) | Where {$_.Subject -like "*test*"}

Received            Sender Address              Recipient Address           Subject                    Status        
--------            --------------              -----------------           -------                    ------        
14/06/2023 10.01.30 ms-noreply@microsoft.com    msadmin@m365info.com        Get the latest Office apps Delivered     
14/06/2023 01.57.05 beata@defenderarchitect.com stephen.hunter@m365info.com Test your Junk mail!       FilteredAsSpam
12/06/2023 14.24.28 ryan.przybyl@hds-rx.com     stephen.hunter@m365info.com spam filter test           FilteredAsSpam
09/06/2023 10.13.47 susanbernard@gmail.com      amanda.hansen@m365info.com  This is a test             Delivered     
09/06/2023 10.04.16 susanbernard@gmail.com      stephen.hunter@m365info.com Re: Test                   Delivered     
09/06/2023 10.01.37 Stephen.Hunter@m365info.com susanbernard@gmail.com      Test                       Delivered     
06/06/2023 20.34.22 susanbernard@gmail.com      stephen.hunter@m365info.com Test your Junk mail!       FilteredAsSpam
06/06/2023 20.25.41 susanbernard@gmail.com      stephen.hunter@m365info.com Just a test!               Delivered     

Get-MessageTrace filters results by source or destination IP address

The IP address is the public IP address of the mail server that represents a specific domain name or specific recipient.

The Get-MessageTrace parameters -ToIP and -FromIP, allow us to retrieve information about emails sent from a specific IP address or sent to a specific IP address.

First, we will use the parameter -ToIP, which relates to the IP address of the mail server Exchange Online.

ParameterDescription
ToIPThe ToIP parameter filters the results by the destination IP address. For outgoing messages, the value of ToIP is the public IP address in the resolved MX record for the destination domain. For incoming messages to Exchange Online, the value is blank.
FromIPThe FromIP parameter filters the results by the source IP address. For incoming messages, the value of FromIP is the public IP address of the SMTP email server that sent the message.

ToIP – Get information about emails sent to the destination mail server with a specific IP address

Obtain information about emails sent to a mail server with a specific IP address.

PowerShell command syntax.

Get-MessageTrace -StartDate <mm/dd/yyyy> -EndDate <mm/dd/yyyy> -ToIP <IP address>

In the following example, we want to obtain information about mail items sent in the last 10 days to a destination mail server with the IP address 10.0.0.2.

PowerShell command example.

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) -ToIP 10.0.0.2

FromIP – Obtain information about emails sent from a specific IP address

The Get-MessageTrace parameter -FromIP, allows us to retrieve information about emails sent from a specific IP address.

Retrieve information about emails received from a mail server with a specific IP address.

PowerShell command syntax.

Get-MessageTrace -StartDate <mm/dd/yyyy> -EndDate <mm/dd/yyyy> -FromIP <IP address>

In the following example, we want to obtain information about mail items sent in the last 10 days by the mail server with the IP address 10.0.0.2.

PowerShell command example.

Get-MessageTrace -StartDate (Get-Date).Adddays(-10) -EndDate (Get-Date) -FromIP 10.0.0.2

PowerShell output result.

PS C:\> Get-MessageTrace -StartDate (Get-Date).Adddays(-10) -EndDate (Get-Date) -FromIP 80.71.142.100

Received            Sender Address              Recipient Address           Subject            Status   
--------            --------------              -----------------           -------            ------   
15/06/2023 19.45.30 Stephen.Hunter@m365info.com amanda.hansen@m365info.com  RE: مرحبا كيف حالك    Delivered
15/06/2023 19.42.43 Amanda.Hansen@m365info.com  stephen.hunter@m365info.com مرحبا كيف حالك        Delivered
09/06/2023 10.01.37 Stephen.Hunter@m365info.com susanbernard@gmail.com      Test               Delivered
09/06/2023 09.58.06 Amanda.Hansen@m365info.com  stephen.hunter@m365info.com RE: Available      Delivered
09/06/2023 09.56.06 Stephen.Hunter@m365info.com amanda.hansen@m365info.com  Available          Delivered

Extend Page or PageSize number results

When using the PowerShell command Get-MessageTrace to display information, there is a built-in limitation to the number of mails. The unit that specifies the displayed result limitation is called Page.

Note: By default, the Get-MessageTrace will only display 1 page. Each page unit includes 1,000 rows by default.

By default, the Get-MessageTrace command will display a maximum of 1,000 results, even though the search result includes more than 1,000 rows. Therefore we need to use a parameter that can help us to get a larger number of results.

Get-MessageTrace includes two parameters that relate to the subject of maximum displayed results:

ParameterDescription
PageThe Page parameter specifies the page number of the results you want to view. Valid input for this parameter is an integer between 1 and 1000. The default value is 1.
PageSizeThe PageSize parameter specifies the maximum number of entries per page. Valid input for this parameter is an integer between 1 and 5000. The default value is 1000.

Extend default PageSize limitation

One way to extend the PageSize limit to 5,000.

PowerShell command syntax.

Get-MessageTrace -StartDate <mm/dd/yyyy> -EndDate <mm/dd/yyyy> -PageSize <number or records that each page includes>

PowerShell command example.

Get-MessageTrace -StartDate (Get-Date).Adddays(-10) -EndDate (Get-Date) -PageSize 5000

If you have 20 pages, you can use PowerShell to get information on a particular page number.

PowerShell command syntax.

Get-MessageTrace -StartDate <mm/dd/yyyy> -EndDate <mm/dd/yyyy> -Page <page number>

Run the PowerShell command example to see the information on page number 5.

Get-MessageTrace -StartDate (Get-Date).Adddays(-10) -EndDate (Get-Date) -Page 5

Use MessageTraceDetail on specific mail

As mentioned before, the Get-MessageTrace cmdlet provides us with basic information about a specific mail.

If we want more detailed information about a specific mail, we can add the PowerShell command Get-MessageTraceDetail.

We will add the MessageTraceDetail cmdlet to the original Get-MessageTrace command.

Note: Use the Get-MessageTraceDetail cmdlet to view the message trace event details for a specific message. These detailed results take more time than the Get-MessageTrace results.

Get message details for all sent and received emails in the last 3 days.

PowerShell command example:

Get-MessageTrace -StartDate (Get-Date).AddDays(-3) -EndDate (Get-Date) | Get-MessageTraceDetail

You have to wait a few minutes to see the results on the PowerShell console.

PowerShell output result.

PS C:\> Get-MessageTrace -StartDate (Get-Date).AddDays(-3) -EndDate (Get-Date) | Get-MessageTraceDetail

Date                   Event                Detail                                                                                                                                                   
----                   -----                ------                                                                                                                                                   
15/06/2023 11.54.24    Receive (with ext... Message received by: DU0PR02MB8289.eurprd02.prod.outlook.com. There was a delay of 1907 minutes prior to the message being received by Office 365.       
15/06/2023 11.54.26    Spam                 No detail information available.                                                                                                                         
15/06/2023 11.54.27    Deliver              The message was delivered to the Junk Email folder.                                                                                                      
14/06/2023 11.22.44    Receive              Message received by: DB3PR0202MB9154.eurprd02.prod.outlook.com using TLS1.2 with AES256                                                                  
14/06/2023 11.22.45    Deliver              The message was successfully delivered.                                                                                                                  
14/06/2023 10.01.31    Receive              Message received by: DU0PR02MB8716.eurprd02.prod.outlook.com using TLS1.2 with AES256                                                                    
14/06/2023 10.01.33    Deliver              The message was successfully delivered.                                                                                                                  
14/06/2023 08.56.41    Drop                 Reason: [{LED=550 4.3.2 QUEUE.TransportAgent; message deleted by transport agent};{MSG=};{FQDN=};{IP=};{LRT=}]                                           
14/06/2023 08.56.39    Receive              Message received by: AS2PR02MB10153.eurprd02.prod.outlook.com using TLS1.2 with AES256                                                                   
14/06/2023 08.56.40    Fail                 Reason: [{LED=550 5.1.10 RESOLVER.ADR.RecipientNotFound; Recipient msadmin@m365info.com not found by SMTP address lookup};{MSG=};{FQDN=};{IP=};{LRT=}]   
14/06/2023 01.57.06    Receive              Message received by: DU0PR02MB8039.eurprd02.prod.outlook.com using TLS1.2 with AES256                                                                    
14/06/2023 01.57.07    Spam                 No detail information available.                                                                                                                         
14/06/2023 01.57.08    Deliver              The message was delivered to the Junk Email folder.                                                                                                      
13/06/2023 07.22.04    Receive              Message received by: GV1PR02MB7779.eurprd02.prod.outlook.com                                                                                             
13/06/2023 07.22.08    Deliver              The message was successfully delivered.                                                                                                                  

Next, we will show you how to export PowerShell information to a file.

Export Get-MessageTrace results to file

You can also export the information to a file format supported by PowerShell. PowerShell supports exporting output to the following file formats: Text, CSV, HTML, and XML.

When we export the command output to a file, we need to tell PowerShell the required format we want.

In addition to the PowerShell cmdlets that we use to define the specific file format, we can add a specific parameter that relates to the specific file format.

For example, when we wish to export PowerShell command output to a CSV (Comma Separated Value) file format, we can add additional parameters such as:

ParameterDescription
-NoTypeInformationPrevents to add unnecessary information to the CSV file.
-Encoding UTF8It ensures that non-English characters included in users or mailboxes can be exported across different systems, applications, and programming languages that support UTF-8 encoding

1. Create file name and path

It is required to name the file you export with PowerShell. The additional part is to choose a directory path. The path parameter defines the location where we want to save the file, such as C:\temp.

However, the path parameter is not mandatory. If we don’t provide a specific path, PowerShell exports the file to the folder from which we run the PowerShell command.

Note: By default, the PowerShell command will not create a specific folder specified in the path.

2. Export to file type format

We will show the PowerShell syntax to export information to various file types.

To export information to a file format in PowerShell, you need these two parts:

  1. Type the Get PowerShell cmdlets that fetch specific information.
  2. Define the specific file format, the path, and the filename.

Look at the below PowerShell examples to export information in three file formats; Text, CSV, and HTML.

Export information to Text File

PowerShell command example

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) | Out-File "C:\Temp\All emails in the last month.TXT"

Export information to CSV File

PowerShell command example

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) | Export-CSV "C:\Temp\All emails in the last month.CSV" –NoTypeInformation -Encoding UTF8

Export information to HTML File

PowerShell command example

Get-MessageTrace -StartDate (Get-Date).AddDays(-10) -EndDate (Get-Date) | ConvertTo-Html | Out-File "C:\Temp\All emails in the last month.HTML"

Read more: Configure Catch all Mailbox in Microsoft 365 »

Conclusion

You learned how to use the Get-MessageTrace PowerShell cmdlet to view Exchange Online messages for up to 10 days old. It’s an excellent way to gather specific data from a time range and export to csv file.

Did you enjoy this article? You may also like Enable or disable Exchange ActiveSync mailboxes. Don’t forget to follow us and share this article.

Exchange Online historical message trace report

$
0
0

The message trace report displays information about each incoming and outgoing mail sent over the last 90 days in Exchange Online. In this article, you will learn how to export a message trace report in Exchange admin center and with the HistoricalSearch PowerShell cmdlet.

Exchange message trace

Exchange Online has information about each mail flow transaction in our mail infrastructure that passes via the server and is kept for 90 days.

You can get message trace information for up to 90 days in the Exchange admin center and with Exchange Online PowerShell. We will show you how to export the message trace report to a CSV file with the HistoricalSearch PowerShell cmdlet.

Suppose you want to get faster results and export information on each mail sent and received in Exchange Online for up to 10 days, you can read the article Get Message Trace in Exchange Online.

Get-HistoricalSearch PowerShell cmdlet

First, we will look at the advantages and disadvantages of the Get-Historical PowerShell cmdlet.

Advantages:

  • Exchange Online server log files register detailed information about each mail transaction.
  • Exchange Online provides us with an extended time range of 90 days. It allows you to retrieve mail transaction information for a longer duration. There is no 10-day limitation like when using the PowerShell command Get-MessageTrace.

Disadvantages:

  • Exchange Online registers the request for information as a task and executes it after several hours.
  • The information you get can be overwhelming, and it’s not easy to read and understand.
  • The information is only available in a CSV report.

If you require information about a mail transaction older than 10 days, use the PowerShell command Get-HistoricalSearch. Also, when you want to investigate a specific mail transaction registered in the Exchange Online log file.

Message trace reports

You can view and export the log information using the message trace in the Exchange admin center.

There are 3 types of reports in the Exchange admin center.

Summary report:

  • Instant online access.
  • The information is displayed in an HTML window, but you export results.
  • Shows data of mail messages up to 10 days old.
  • The log data only includes essential information.

Enhanced summary report:

  • Export and download the information to a CSV (Comma Separated Values) file.
  • Shows data of mail messages up to 90 days old.
  • The log data includes more detailed information.

Extended report:

  • You can export and download the information to a CSV file.
  • Shows data of mail messages up to 90 days old.
  • The log data is very comprehensive and with more detailed information.

Note: With the PowerShell cmdlet Historical Search, you can only export the enhanced summary report.

Export extended message trace report in EAC

Requirements to export an extended message trace report in the Exchange admin center.

  • Fill in one of the following fields: Sender, Recipient, or Message ID.
  • To ensure all messages are returned, you need to specify the recipient.
  • You must select a date range of more than 10 days.

Time needed: 15 minutes.

Prepare message trace extended report in Exchange admin center:

  1. Go to Exchange admin center

    Sign in to the Exchange admin center with your admin credentials.

  2. Start a trace

    Click on Mail flow > Message trace > Start a trace.

    Start message trace report in EAC

  3. Add senders

    Add a specific sender. Put an asterisk * before the domain name to include all organization senders.

    Add senders message trace report in EAC

  4. Add recipients

    Add a specific recipient and select it from the suggested results. Put an asterisk * before the domain name if you only want to include all organization recipients.

    Add recipients start message trace report in EAC

  5. Custom time range

    Click on Custom time range.

    Custom time range for message trace report in EAC

  6. Start and End date

    Change the Time Zone to your country.
    Choose a Start date and End date.
    The time range must be more than 10 days.

    Custom start and end date message trace report in EAC

  7. Report type

    Select the Extended report and click Next.

    Start extended message trace report in EAC

  8. Prepare message trace report

    Change Report title (optional)
    Specify your email to be notified
    Click Prepare report.

    Prepare message trace report in EAC

Check message trace report status

Next, you can check the status of the message trace report in the Exchange admin center: Go to Mail flow > Message trace > Downloadable reports.

At first, the status shows Not started.

Message trace report in EAC status Not Started

After a couple of minutes, the status changes to In progress.

Message trace report in EAC status In Progress

It can take a couple of hours for the report to be completed. Once the report is finished, you will be notified by the email you provided. This email must have a license assigned, or you can’t access emails in Outlook.

Note: There is a limit of 250 historical searches you can submit in one day. The CSV file will not exceed 100,000 lines or results.

Export enhanced message trace report with PowerShell

You can also use the Exchange Online PowerShell cmdlet HistoricalSearch to export message trace results for up to 90 days. It can only export an enhanced summary report.

1. Start HistoricalSearch

Start a new historical search for messages less than 90 days old.

To use the PowerShell Start-HistoricalSearch cmdlet to create an enhanced message trace summary report, you need to fill in these parameters:

  • Date range: StartDate 05/01/2023 to EndDate 06/14/2023.
  • Report Type: Name the file “Report Amanda
  • Sender Address: Amanda.Hansen@m365info.com
  • Notification email address: admin@m365info.com

PowerShell command example:

Start-HistoricalSearch -ReportTitle "Report Amanda" -SenderAddress "Amanda.Hansen@m365info.com" -ReportType MessageTrace -StartDate 05/01/2023 -EndDate 06/01/2023 -NotifyAddress admin@m365info.com

The PowerShell output shows this result below.

PS C:\> Start-HistoricalSearch -ReportTitle "Report Amanda" -SenderAddress "Amanda.Hansen@m365info.com" -ReportType MessageTrace -StartDate 05/01/2023 -EndDate 06/14/2023 -NotifyAddress admin@m365info.com

JobId                                SubmitDate          ReportTitle   Status     Rows ErrorCode ErrorDescription
-----                                ----------          -----------   ------     ---- --------- ----------------
5f2cf07a-294b-4d86-8170-2d4b11536551 14/06/2023 10.35.59 Report Amanda NotStarted 0   

After a couple of minutes, the status changes to In Progress.

PS C:\> Start-HistoricalSearch -ReportTitle "Report Amanda" -SenderAddress "Amanda.Hansen@m365info.com" -ReportType MessageTrace -StartDate 05/01/2023 -EndDate 06/14/2023 -NotifyAddress admin@m365info.com

JobId                                SubmitDate          ReportTitle   Status     Rows ErrorCode ErrorDescription
-----                                ----------          -----------   ------     ---- --------- ----------------
5f2cf07a-294b-4d86-8170-2d4b11536551 14/06/2023 10.35.59 Report Amanda InProgress 0   

Suppose you want to select all users in your organization as senders. Put an asterisk * before the domain name in the -SenderAddress.

Start-HistoricalSearch -ReportTitle "Report All Organization Senders" -SenderAddress "*m365info.com" -ReportType MessageTrace -StartDate 05/01/2023 -EndDate 06/01/2023 -NotifyAddress admin@m365info.onmicrosoft.com

2. Get HistoricalSearch

Use the PowerShell Get-HistoricalSearch to view information about historical searches performed within the last 10 days.

Get-HistoricalSearch

The PowerShell result shows all the reports that are Not Started, In Progress, Cancelled, and Done.

PS C:\> Get-HistoricalSearch

JobId                                SubmitDate          ReportTitle          Status    Rows ErrorCode ErrorDescription
-----                                ----------          -----------          ------    ---- --------- ----------------
277856a3-2e43-476c-b243-ec7d7537d56d 14/06/2023 08.25.54 Message trace report Done      41                             
5f2cf07a-294b-4d86-8170-2d4b11536551 14/06/2023 10.35.59 Report Amanda        Cancelled 0                              
0fed916e-794a-448d-9cf3-1897798f4543 14/06/2023 10.39.51 Report Amanda        Done      41  

You can also check the progress of your report in the Exchange admin center under Downloadable reports. You will get a notification mail once the status changes to Done.

Use the PowerShell Get-HistoricalSearch cmdlet to check the status of a single JobId.

Get-HistoricalSearch -JobId 5f2cf07a-294b-4d86-8170-2d4b11536551

The PowerShell result shows that the status value is Cancelled for this particular JobId.

PS C:\> Get-HistoricalSearch -JobId 5f2cf07a-294b-4d86-8170-2d4b11536551

JobId                                SubmitDate          ReportTitle   Status    Rows ErrorCode ErrorDescription
-----                                ----------          -----------   ------    ---- --------- ----------------
5f2cf07a-294b-4d86-8170-2d4b11536551 14/06/2023 10.35.59 Report Amanda Cancelled 0   

Note: There is a limit of 250 historical searches that you can submit in a 24-hour period. So you will get a warning if you are near the daily quota.

You can get the below error if your historical search crosses the limit.

The Hygiene DAL  retried a transient condition the maximum number of times.

3. Stop HistoricalSearch

Let’s say you made a mistake in the SenderAddress or StartDate and want to cancel the historical search.

Note: You can stop queued historical searches where the status value is Not Started.

Use the PowerShell cmdlet Stop-HistoricalSearch to stop a specific historical search.

The PowerShell command syntax.

Stop-HistoricalSearch -JobId <JobId value>

This PowerShell example stops the historical search.

Stop-HistoricalSearch -JobId 5f2cf07a-294b-4d86-8170-2d4b11536551

Download message trace report

There are two ways to download the extended message trace CSV file report:

  • Click the hyperlink in the mail you get when the report is ready
  • Download the report in the Exchange admin center

Once the report is completed, you can open the mail and click here. It will open a new pane to download the report.

Or download the report in the Exchange admin center. Go to Mail flow > Message Trace > Downloadable reports.

Click on the report from the list so the pane opens up, and Download the report.

Download message trace report in EAC

Open message trace report CSV file in Excel

Once you download the file, you can save it as .csv with UTF-8 encoding. If you immediately open the message trace report with an application like Microsoft Excel, the information will be incorrect.

The date and time information is not understandable, and the report looks unstructured. Also, all non-English characters are not readable and look like symbols. Luckily there is a way to fix this.

Before opening the message trace report, we need to make a few changes in Excel.

First, you need to make Microsoft Excel use a comma for the list separator:

  • Open Microsoft Excel
  • Click Options
Edit Microsoft Excel options

Go to the Excel Options to save changes:

  • Click Advanced
  • Under Editing options > Clear System separators
  • Set Decimal separator to period (.)
  • Set Thousands separator to comma (,)
  • Click OK
Change system separators in Excel options

Note: Close the Microsoft Excel application to save the changes.

Next, we are going to load the message trace report in Microsoft Excel:

  • Open the application Microsoft Excel
  • Select New blank workbook
Open new blank workbook in Excel
  • Click on Data > From Text/CSV
Load data from text or csv in Excel
  • Find and select Message trace report.csv
  • Click Import
Import csv file in Excel
  • Set the delimiter to Comma
  • Click Load
Load and import message trace report in Microsoft Excel

Microsoft Excel loads and formats the data from the CSV file. The message trace report results are structured and correct. Now you will also be able to read non-English characters like Arabic, Chinese, etc.

  • Sort and filter the columns by clicking on the arrows in the first row
Message trace report in Excel

That’s it!

Read more: Export Microsoft 365 mailbox to PST file »

Conclusion

You learned how to export a message trace report in Exchange admin center and with the HistoricalSearch PowerShell cmdlet. The message trace report shows detailed information about messages in Exchange Online for up to 90 days. This way, you can adjust the CSV file and search for specific details of messages.

Did you enjoy this article? You may also like Export Microsoft 365 mailbox size report with PowerShell. Don’t forget to follow us and share this article.

Fix Outlook error 500 repeating redirects

$
0
0

A user gets an error message when accessing Outlook on the web. Even if the user tries different browsers and clears the browser cache, the same Outlook error 500 something went wrong keeps appearing. In this article, you will learn how to fix Outlook on the web error 500 repeating redirects detected.

Outlook error 500 repeating redirects detected

When the user signs into Outlook on the web, the page will loop several times without any success, and the below error appears:

Error 500 Something went wrong. Repeating redirects detected. Click here to sign out.

The sign-in with the user credentials looks good because you see the click here to sign out text. But, a repeating redirect is detected in Outlook.

This is how it looks for the user on their web browser.

Fix Outlook error 500 repeating redirects web

Even if the user signs out and tries to sign back in again, the below error can appear.

We couldn’t sign you in. Please try again.

Fix Outlook error 500 repeating redirects sign-in

Let’s have another look and let the user sign in to the Microsoft 365 portal. The sign-in is successful, and from there, the Outlook app can be clicked on. But, in the end, the same Outlook error 500 redirect appears.

Fix Outlook error 500 repeating redirects portal

Why is it that the user can sign into the Microsoft 365 portal successfully, but when opening Outlook on the web, an error 500 redirect appears?

Solution to Outlook error 500 repeating redirects detected

The Outlook on the web error 500 repeating redirect detected occurs when a Microsoft 365 user account is recently unblocked from sign-in. Unfortunately, the admin that unblocked the user account didn’t mention to the user that a waiting time of 30 minutes applies.

When you block a user’s sign-in and revoke their active sessions, and then unblock the account, there might be a delay before the user can sign in and access all Microsoft 365 services. During the restoration process of access, certain services like OneDrive may become available earlier than others, such as Outlook.

That’s it!

Read more: Increase and improve Azure MFA security »

Conclusion

You learned how to fix Outlook error 500 repeating redirects detected. The solution to this problem is waiting 30 minutes after the user account is unblocked. After that, the user can sign in to Outlook on the web without any redirect error.

Did you enjoy this article? You may also like Reset MFA for Microsoft 365 user. Don’t forget to follow us and share this article.

Block Microsoft 365 user sign-in

$
0
0

When a Microsoft 365 user account is compromised, you must immediately block the user from signing in. Doing that will also sign out all the user sessions within 60 minutes. In this article, you will learn how to block a Microsoft 365 user sign-in using Microsoft 365 admin center and Microsoft Graph PowerShell.

Microsoft 365 user sign-in blocked

You can block a user from signing in to all Microsoft 365 services in two methods:

  • Microsoft 365 admin center
  • Microsoft Graph PowerShell

Note: When you block someone, it immediately stops any new sign-ins for that account. If a user is signed in, they will be automatically signed out from all Microsoft services within 60 minutes.

Block user in Microsoft 365 admin center

First, we will show you the steps to block a sign-in in Microsoft 365 admin center for a single user. Then we will show you the steps to block multiple users sign-in.

Block single Microsoft 365 user sign-in

Time needed: 10 minutes.

How to block Microsoft 365 user sign-in.

  1. Go to Microsoft 365 admin center

    Sign in with your admin credentials

  2. Select the user you want to block.

    Click Users > Active users
    Select the unblocked user from the list

    Block user sign-in Microsoft 365 admin center

  3. The user pane opens.

    Click Block sign-in

    Block sign-in Microsoft 365 user account

  4. Block sign-in for user.

    Select Block this user from signing in
    Click Save changes

    Block sign-in Microsoft 365 user account

  5. The user is now blocked from signing in.

    Close the pane

    Block sign-in Microsoft 365 user account

Note: The user will be automatically signed out of all Microsoft services within 60 minutes.

Block multiple Microsoft 365 users

To block multiple Microsoft 365 user accounts, follow these steps:

  1. Go to Users > Active users
  2. Select the users in the list
  3. Click the More button
  4. Click Edit sign-in status
Block multiple Microsoft users sign-in status
  1. Select Block users from signing in
  2. Click Save
Block users from signing in

The selected users are blocked from signing in.

Note: The blocked users will not be able to sign in to any Microsoft services, and they will be signed out of all sessions within 60 minutes.

Verify blocked Microsoft 365 user sign-in

To verify you blocked the users, you can filter and find the blocked users in the list.

  • Go to User > Active users
  • Click Filter > Sign-in blocked

It shows a list of all the sign-in blocked users.

Show list of all users sign-in blocked

Block user with Microsoft Graph PowerShell

Another way to block a user sign-in is with Microsoft Graph PowerShell. You can use one of the below PowerShell scripts to block a single user or multiple users.

Block single Microsoft 365 user sign-in

  1. Copy the below PowerShell script into PowerShell ISE or Visual Studio Code
  2. Change the user principal name (UPN) of the account you want to block on line number 6
  3. Run the below PowerShell script
# Connect to Microsoft Graph PowerShell
Connect-MgGraph -Scopes Directory.AccessAsUser.All
Select-MgProfile Beta

# Specify the user principal name (UPN) of the account you want to block
$upn = "amanda.hansen@m365info.com"

# Retrieve the user
$user = Get-MgUser -Filter "UserPrincipalName eq '$upn'"

# Check if the user is unblocked
if ($user.AccountEnabled -eq $true) {

    # User is unblocked, block the account
    Update-MgUser -UserId $User.Id -AccountEnabled:$false

    Write-Host "Account $($User.UserPrincipalName) blocked successfully." -ForegroundColor Green
}
else {
    Write-Host "Account $($User.UserPrincipalName) is already blocked." -ForegroundColor Cyan
}

The output shows that the user account is blocked.

Welcome To Microsoft Graph!
Account Amanda.Hansen@m365info.com blocked successfully.

If the Microsoft user account were blocked, the output would show that the account is already blocked.

Welcome To Microsoft Graph!
Account Amanda.Hansen@m365info.com is already blocked.

If you like to block multiple users, read the next step.

Block multiple Microsoft 365 users

Follow the below steps to block multiple Microsoft 365 users sign-in with Microsoft Graph PowerShell.

  1. Create a .txt file and type the user accounts you want to block
  1. Go to the C:\temp folder
  2. Name the file
  3. Save it as a .txt file
  4. Click Save
Save Microsoft 365 user accounts as txt file
  1. Run the below PowerShell script
# Connect to Microsoft Graph PowerShell
Connect-MgGraph -Scopes Directory.AccessAsUser.All
Select-MgProfile Beta

# Specify the path to the text file containing user principal names (UPNs)
$upns = Get-Content -Path "C:\temp\Users.txt"

# Loop through each UPN in the array
foreach ($upn in $upns) {
    # Retrieve the user
    $user = Get-MgUser -Filter "UserPrincipalName eq '$upn'"

    if ($user) {
        # Check if the user is unblocked
        if ($user.AccountEnabled -eq $true) {

            # User is unblocked, block the account
            Update-MgUser -UserId $user.Id -AccountEnabled:$false
            Write-Host "Account $($user.UserPrincipalName) blocked successfully." -ForegroundColor Green
        }
        else {
            Write-Host "Account $($user.UserPrincipalName) is already blocked." -ForegroundColor Cyan
        }
    }
    else {
        Write-Host "Account $upn not found." -ForegroundColor Yellow
    }
}

The output blocks the Microsoft 365 user accounts in the .txt file.

It will not block these user accounts if:

  • The user account is already blocked
  • The user account does not exist
Welcome To Microsoft Graph!
Account Amanda.Hansen@m365info.com blocked successfully.
Account Amanda.Kent@m365info.com not found.
Account Brenda.Smith@m365info.com is already blocked
Account David.Kent@m365info.com is already blocked
Account Stephen.Hunter@m365info.com blocked successfully.

Verify Microsoft 365 user sign-in blocked

When the blocked user tries to log into Microsoft 365, they will see this warning below.

Your account has been locked. Contact your support person to unlock it, then try again.

You successfully blocked Microsoft 365 user sign-in!

Read more: Change Microsoft 365 tenant display name »

Conclusion

You learned how to block sign-in for Microsoft 365 users. It can be done in Microsoft 365 admin center and with Microsoft Graph PowerShell. To block multiple users, it’s much faster to use a .txt file and run the PowerShell script.

Did you enjoy this article? You may also like Configure technical contact details in Microsoft 365. Don’t forget to follow us and share this article.

Manage Microsoft 365 clutter using PowerShell

$
0
0

The clutter feature in Microsoft 365 mailbox lets the users focus on important mail. The low-priority emails are not deleted but removed from the inbox mail folder to the clutter folder. You can always disable the clutter feature for all users and remove the clutter folder from Outlook. In this article, you will learn to manage Microsoft 365 clutter feature using PowerShell.

Microsoft 365 clutter feature

Clutter is a feature in Outlook that moves less important emails out of your inbox and keeps you focused on what’s most important to you. We will show you how to enable and disable clutter for all mailboxes with PowerShell.

Once a user turns off the clutter feature in Outlook, they can use the new Focused Inbox feature. This is a new email sorting, where your inbox will be divided into two tabs. You can always Manage focused inbox in Microsoft 365 using PowerShell.

Connect to Exchange Online PowerShell

To be able to run the PowerShell commands specified in the current article, you will need to Connect to Exchange Online PowerShell.

Start Windows PowerShell as administrator and run the cmdlet Connect-ExchangeOnline.

Connect-ExchangeOnline

1. Enable clutter for Microsoft 365 mailboxes

Enable clutter for a specific mailbox

PowerShell command syntax:

Set-Clutter -Identity -Enable $True

PowerShell command example:

Set-Clutter -Identity "Stephen.Hunter@m365info.com" -Enable $True

PowerShell result:

IsEnabled       : True
MailboxIdentity : CN=ea2b7e6a-fb01-42e3-9fb8-ccf13a5f2e67,OU=ms365info.onmicrosoft.com,OU=Microsoft Exchange Hosted Organizations,DC=EURPR02A011,DC=PROD,DC=OUTLOOK,DC=COM
Identity        : 
IsValid         : True
ObjectState     : New

Once this user signs in to Outlook, they will see the Clutter folder appear.

Manage Microsoft 365 clutter using PowerShell

Bulk enable clutter for user mailboxes

Run the below PowerShell command to bulk enable clutter for user mailboxes.

$AllMailboxes = Get-MailBox -ResultSize Unlimited -Filter '(RecipientTypeDetails -eq "UserMailbox")' | Where-Object { (Get-Clutter -Identity $_.UserPrincipalName).IsEnabled -eq $False }

ForEach ($Mailbox in $AllMailboxes) {
    Set-Clutter -Identity $Mailbox.UserPrincipalName -Enable $True
}

Bulk enable clutter for Microsoft 365 mailboxes

Use the below PowerShell command to bulk enable clutter for all types of mailboxes.

Get-Mailbox -ResultSize Unlimited | Set-Clutter -Enable $True

2. Display clutter information using PowerShell

Display clutter information of a single mailbox

PowerShell command syntax:

Get-Clutter -Identity | Select-Object IsEnabled,MailboxIdentity

PowerShell command example:

Get-Clutter -Identity "Stephen.Hunter@m365info.com" | Select-Object IsEnabled,MailboxIdentity

See the below PowerShell result of a single mailbox:

IsEnabled MailboxIdentity
--------- ---------------
     True CN=ea2b7e6a-fb01-42e3-9fb8-ccf13a5f2e67,OU=ms365info.onmicrosoft.com,OU=Microsoft Exchange Hosted Organizations,DC=EURPR02A011,DC=PROD,DC=OUTLOOK,DC=COM

Display clutter for all user mailboxes

Show all user mailboxes that have enabled or disabled the clutter feature with the below PowerShell command.

$Results = @()

$AllMailboxes = Get-MailBox -Filter '(RecipientTypeDetails -eq "UserMailbox")'

ForEach ($Mailbox in $AllMailboxes) {
    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
}

$Results | Select-Object Recipient,ClutterEnabled

The PowerShell outcome shows a list of all the user mailboxes that have clutter enabled (True) or disabled (False).

Recipient                   ClutterEnabled
---------                   --------------
Stephen.Hunter@m365info.com           True
Brenda.Smith@m365info.com            False
David.Kent@m365info.com              False
Susan.Brown@m365info.com             False
Chris.Lucas@m365info.com             False
George.Wilson@m365info.com           False
Jill.Bates@m365info.com              False
Diana.Baker@m365info.com             False
Mary.James@m365info.com              False
Amanda.Hansen@m365info.com           False
KellyTest@m365info.com               False

Display all Microsoft 365 mailboxes with clutter disabled

Show all Microsoft 365 mailboxes that have disabled clutter with the below PowerShell command.

$Results = @()

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  | Where-Object { (Get-Clutter -Identity $_.alias).IsEnabled -eq $False }

ForEach ($Mailbox in $AllMailboxes) {
    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
}
$Results | Select-Object Recipient,ClutterEnabled

PowerShell result:

Recipient                                                                              ClutterEnabled
---------                                                                              --------------
Amanda.Hansen@m365info.com                                                                      False
Brenda.Smith@m365info.com                                                                       False
Chris.Lucas@m365info.com                                                                        False
David.Kent@m365info.com                                                                         False
Diana.Baker@m365info.com                                                                        False
DiscoverySearchMailbox{D919BA05-46A6-415f-80AD-7E09334BB852}@ms365info.onmicrosoft.com          False
George.Wilson@m365info.com                                                                      False
InfoBox@m365info.com                                                                            False
Jill.Bates@m365info.com                                                                         False
KellyTest@m365info.com                                                                          False
Mary.James@m365info.com                                                                         False
Projector11@m365info.com                                                                        False
Projector21@m365info.com                                                                        False
Projector8@m365info.com                                                                         False
infoRESTORE@m365info.com                                                                        False
RoomTest8@m365info.com                                                                          False
Susan.Brown@m365info.com                                                                        False

Display all Microsoft 365 mailboxes with clutter enabled

It will display all Microsoft 365 mailboxes that have enabled clutter.

Use the below PowerShell command example:

$Results = @()

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  | Where-Object { (Get-Clutter -Identity $_.alias).IsEnabled -eq $True }

ForEach ($Mailbox in $AllMailboxes) {
    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
}
$Results | Select-Object Recipient,ClutterEnabled

See below for the PowerShell result:

Recipient                   ClutterEnabled
---------                   --------------
Stephen.Hunter@m365info.com           True

Display clutter folder with number of items and size

PowerShell command example:

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  
ForEach ($Mailbox in $AllMailboxes) {
    ForEach-Object { Get-MailboxFolderStatistics –Identity $Mailbox.UserPrincipalName } | Where-Object { $_.Name –Like "Clutter" } | Format-List Identity, ItemsInFolder, FolderSize
}

See the below PowerShell result:

Identity      : Stephen.Hunter@m365info.com\Clutter
ItemsInFolder : 1
FolderSize    : 6.555 KB (6,712 bytes)

3. Disable clutter for Microsoft 365 mailboxes

Disable clutter for a single mailbox

PowerShell command syntax:

Set-Clutter -Identity -Enable $False

PowerShell command example:

Set-Clutter -Identity "Stephen.Hunter@m365info.com" -Enable $False

See the below PowerShell result example:

IsEnabled       : False
MailboxIdentity : CN=ea2b7e6a-fb01-42e3-9fb8-ccf13a5f2e67,OU=ms365info.onmicrosoft.com,OU=Microsoft Exchange Hosted Organizations,DC=EURPR02A011,DC=PROD,DC=OUTLOOK,DC=COM
Identity        : 
IsValid         : True
ObjectState     : New

Note: Close the Outlook application so the changes take effect. You must also sign in the next time you open the Outlook application or use Outlook on the web.

It will disable the clutter function in the Microsoft 365 mailbox. However, when you open the Outlook application, you will still see the clutter folder in the Outlook mailbox. In the next step, we will show you how to remove the clutter folder from Outlook.

Turn on Focused Inbox

You can’t delete the clutter folder in Outlook, as it is greyed out. The solution to this problem is to turn on the focused inbox in your Outlook.

Follow the steps to turn on Focused Inbox in the Outlook application:

  • Click on the Inbox folder
  • Click on the View tab
  • Click Show Focused Inbox
Disable clutter for all users. Remove clutter from Outlook

Turn on Focused Inbox in Outlook on the web:

  • Click on the Inbox folder
  • Click on Settings
  • Select the toggle next to Focused Inbox
Disable clutter for all users. Remove clutter from Outlook

You will immediately get a mail from Microsoft Outlook to welcome you to the focused inbox. From now on, messages won’t be moved to the clutter folder anymore. Instead, the less important emails that would have been moved to Clutter now go to Other.

Bulk disable clutter for all mailboxes

To disable the clutter option for all existing Exchange Online mailboxes in the PowerShell console, run the following command.

Get-Mailbox -ResultSize Unlimited | Set-Clutter -Enable $False

4. Export clutter information to CSV

Export clutter settings of a single mailbox to CSV file

PowerShell command example:

Get-Clutter -Identity "Stephen.Hunter@m365info.com" | Export-Csv "C:\temp\Stephen Hunter Clutter.csv" -NoTypeInformation -Encoding UTF8

It will export the CSV to the C:\temp folder. Open the CSV file with an application like Microsoft Excel to see the results.

Manage Microsoft 365 user mailboxes clutter using PowerShell CSV

Export user mailboxes with clutter enabled to CSV file

Run the below PowerShell command to export a list of all user mailboxes with clutter. This way, you can easily search for user mailboxes that have enabled or disabled clutter.

$Results = @()

$AllMailboxes = Get-MailBox -Filter '(RecipientTypeDetails -eq "UserMailbox")'

ForEach ($Mailbox in $AllMailboxes) {
    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
    $ExportData = $Results
}
$Results | Select-Object Recipient,ClutterEnabled

$ExportData | Export-Csv "C:\temp\Clutter User Mailboxes.csv" -NoTypeInformation -Encoding UTF8

Open the CSV file with Microsoft Excel in the C: \temp folder. It shows the list of all user mailboxes with the clutter feature enabled or disabled.

Manage Microsoft 365 clutter using PowerShell CSV

Export all Microsoft 365 mailboxes with clutter disabled to CSV file

Run the below PowerShell command to export a list of all mailboxes with the clutter feature disabled.

$Results = @()

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  | Where-Object { (Get-Clutter -Identity $_.alias).IsEnabled -eq $False }

ForEach ($Mailbox in $AllMailboxes) {
    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
    $ExportData = $Results
}
$Results | Select-Object Recipient,ClutterEnabled

$ExportData | Export-Csv "C:\temp\Clutter Disabled Mailboxes.csv" -NoTypeInformation -Encoding UTF8

It will export the CSV to the C:\temp folder, where you can open the CSV file with Microsoft Excel. You can easily see which Microsoft 365 mailboxes have clutter disabled.

Disable clutter in microsoft 365 mailbox

Export mailboxes with clutter enabled to CSV file

Run the below PowerShell command to export a list of all mailboxes that have the clutter feature enabled.

$Results = @()

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  | Where-Object { (Get-Clutter -Identity $_.alias).IsEnabled -eq $True }

ForEach ($Mailbox in $AllMailboxes) {
    $ClutterStatus = Get-Clutter -Identity $Mailbox.UserPrincipalName | Select-Object -ExpandProperty isEnabled
    $mailboxID = $Mailbox.UserPrincipalName
    $Properties = @{
        ClutterEnabled = $ClutterStatus
        Recipient      = $mailboxID
    }
    $Results += New-Object psobject -Property $properties
    $ExportData = $Results
}
$Results | Select-Object Recipient,ClutterEnabled

$ExportData | Export-Csv "C:\temp\Clutter Enabled Mailboxes.csv" -NoTypeInformation -Encoding UTF8

It will export the CSV to the C:\temp folder, where you can open the CSV file with Microsoft Excel. You will only see a list of mailboxes with the clutter feature enabled.

Disable clutter for all users mailboxes

Export clutter folder items and size

$AllMailboxes = Get-Mailbox -ResultSize Unlimited  
$results = foreach ($Mailbox in $AllMailboxes) {
    Get-MailboxFolderStatistics –Identity $Mailbox.UserPrincipalName | Where-Object { $_.Name –Like "Clutter" } | Select-Object Identity, ItemsInFolder, FolderSize
}

$results | Export-Csv "C:\temp\Clutter Folder.csv" -NoTypeInformation -Encoding UTF8

It will export the CSV to the C:\temp folder, where you can open the CSV file with Microsoft Excel. You will see a list of folder item numbers and size.

Export clutter folder items and size

5. Use Exchange Online rule to bypass clutter

When using the clutter feature, the Exchange server, which manages the user mailbox, decides according to an internal algorithm whether to move or not to move a specific email message to the clutter folder.

In some scenarios, the clutter algorithm can classify email messages as an email that will be sent to the clutter folder, and we would like to override this decision.

To inform the Exchange server that we would like to prevent that clutter process for specific mail items, we need to create an Exchange Online rule.

The Exchange rule is implemented by defining the characters of these specific emails and asking Exchange to add a specific mail field to the email message header.

This special mail filed is named X-MS-Exchange-Organization-BypassClutter.

We will need to add this mail field and set the value of this mail field to true.

For example:

X-MS-Exchange-Organization-BypassClutter = true

If Exchange Server locates this mail field, it understands it must bypass the clutter process.

The Exchange rule can be created manually or via PowerShell.

In the following section, we review two examples of such an Exchange rule that will bypass the clutter of specific mail items.

Create Exchange rule to bypass clutter (specific text)

Create Exchange rule to bypass clutter for emails that include a specific text in the mail subject.

PowerShell command example:

New-TransportRule -Name -SubjectContainsWords "" -SetHeaderName "X-MS-Exchange-Organization-BypassClutter" -SetHeaderValue "true"

PowerShell command example:

New-TransportRule -Name "Bypass Clutter – Subject important" -SubjectContainsWords "important" -SetHeaderName "X-MS-Exchange-Organization-BypassClutter" -SetHeaderValue "true"

Create Exchange rule to bypass clutter (specific sender)

Create Exchange rule to bypass clutter for emails sent from a specific sender.

PowerShell command syntax:

New-TransportRule -Name -From "" -SetHeaderName "X-MS-Exchange-Organization-BypassClutter" -SetHeaderValue "true"

PowerShell command example:

New-TransportRule -Name "Bypass Clutter – Email from Bob" -From Bob@o365info.com -SetHeaderName "X-MS-Exchange-Organization-BypassClutter" -SetHeaderValue "true"

Did this help you to manage the clutter feature in Microsoft 365 with PowerShell?

Read more: Export Microsoft 365 user licenses »

Conclusion

You learned how to manage Microsoft 365 clutter using PowerShell. Once you enable the clutter feature for a user mailbox, you can display the information and export information to a CSV file. Remember that you can always disable the clutter function for all users with PowerShell and remove the clutter folder from Outlook.

Did you enjoy this article? You may also like Manage user mailbox with PowerShell. Don’t forget to follow us and share this article.

Viewing all 370 articles
Browse latest View live