In Exchange Online, Microsoft has a new group named Microsoft 365 Group, which has a better contribution and integration with other Microsoft services.

The Microsft 365 accepts members based on two methods:

  • Dynamic User: Using a query that depend on user attribute.
  • Assigned: Manually add the users to the group.

Learn more about Microsoft 365 Dynamic assignment

So, the focus of this tip is how to assign users from Exchange Online to Microsoft 365 (Assigned) using PowerShell.

You need to have Exchange Online Management PowerShell Module. You can download it using the following command

Install-Module -Name ExchangeOnlineManagement

Take a look at the PowerShell Gallery for more information

Please note that this script adds all Exchange Online Users to the Microsoft 365 group.

$x=get-mailbox | where {$_.UserPrincipalName -notlike "*onmicrosoft*"} | select UserPrincipalName
Add-UnifiedGroupLinks -Identity Office365Migration -LinkType members -Links ($x.UserPrincipalName)

Hope that helps. 🙂

Take a look at other tips and tricks on the PS-Quick Tip Page

Rate this post