An alternative to using PowerShell to copy users from one group to another

a PowerShell alternative to copy users from one group to another

In Microsoft 365 environments with many users, for example more than 1,000 users, it is difficult to make large-scale actions or updates. This includes managing groups, especially when the groups include all the users because it’s impossible to see all group members in one place in the admin portal due to pagination and other limited factors.  PowerShell coding is the most commonly used solution. However, if you need to copy group users from one group to another and then remove some of the users from the new group, this can be a problem for PowerShell. Another solution to the problem is a 3rd-party tool like sapio365. Let’s look at how the two solutions compare.

Copy Microsoft 365 members to another group with PowerShell

If you have the time and skill to write a PowerShell script to add users belonging to one group to another, you will need to combine various cmdlets. The list of PowerShell cmdlets depends on the nature of the original group and of the destination group since managing distribution group members uses a different set. For example, these PowerShell cmdlets can only be used with Microsoft 365 type groups:

  1. Get-UnifiedGroupLinks: to retrieve the members of a Microsoft 365 group
  2. Add-UnifiedGroupLinks: to add members to a Microsoft 365 group

You would also need the PowerShell script to handle the exceptions list of the users you don’t want to add to the new group.

The problem is that using one cmdlet only will not get the entire job done. And checking the results of every action in the PowerShell script at every step is not always feasible.

Copy members to another group quickly using sapio365

Using sapio365 will give you a global view of your environment with all the groups.

You then select the original group (we’ll call it group A) and the new group (group B) and retrieve members from both groups.

Then it’s simply a matter of selecting all the group members and copying them to group B.

You will see a preview of all the members in group B so you can check and make adjustments if necessary. This information is not final until you are satisfied.

There are two ways to remove unwanted members.

  1. With a view of all the members of group B, you can drill down to manually select the members you want to remove.
  2. For more accuracy and speed, you can also use an Excel file that includes the members to be removed. sapio365 will use the Excel file information to find the same users in the group and will automatically select them. All you need to do now is click to remove them.

With just a few clicks you now have a new group B which shares all the same members as Group A except for the ones you selected.

You spent only a few minutes and incurred no risk.

PowerShell scripts are powerful but risky. That risk is multiplied because you have had to use more than one script. The time is takes to find the right ones, adjust it for your purposes takes much longer than simply using sapio365 to accomplish the same task. This doesn’t take into account any problems that may arise if the code does not work. With sapio365, you always get the chance to preview any changes before committing. Read how one of our customers saved hours of time by using sapio365 to copy users from one group to another without PowerShell in just a few clicks.

Eric Houvenaghel

Eric’s passion is solving problems. It’s why he founded his company Ytria – so he could solve problems people had that they didn't even realize they had. With over 2 decades of experience as a software developer, Eric honed his expertise by crafting innovative solutions tailored to the needs of IT teams in both Microsoft 365 and Notes/Domino environments.