Home

Adding team members to a Team using Powershell

%3CLINGO-SUB%20id%3D%22lingo-sub-65035%22%20slang%3D%22en-US%22%3EAdding%20team%20members%20to%20a%20Team%20using%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-65035%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFound%20based%20on%20previous%20questions%20it%20seems%20the%20following%20is%20the%20method%20to%20add%20members%20to%20a%20Microsoft%20Team%20team%20via%20Powershell.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EAdd-UnifiedGroupLinks%20-Identity%20team...%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3ECould%20someone%20confirm%20is%20this%20the%20correct%20way%20to%20achieve%20this%20as%20this%20practically%20only%20adds%20the%20user%20to%20the%20Group%20hosting%20the%20team%2C%20the%20user%20does%20not%20show%20up%20in%20the%20team%20until%20some%20time%20as%20well%20he%20will%20not%20receive%20a%20notification%20of%20beeing%20addedd.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ESo%2C%20how%20do%20I%20add%20the%20user%20to%20the%20team%20in%20the%20correct%20way%20%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3Ea)%20so%20he%20receives%20an%20notification%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Eb)%20so%20he%20shows%20up%20directly%20in%20the%20team%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EIf%20not%20possible%20any%20idea%20on%20how%20long%20it%20takes%20for%20the%20%22background%22%20task%20to%20run%20so%20that%20the%20user%20shows%20up%20in%20the%20teams%20(15min%20or%2024h%3F).%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-65035%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EHow-to%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-290112%22%20slang%3D%22en-US%22%3ERe%3A%20Adding%20team%20members%20to%20a%20Team%20using%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290112%22%20slang%3D%22en-US%22%3E%3CP%3EI%20will%20not%20recommended%20to%20use%20Teams%20PS%20module%20for%20now.%20Team's%20PS%20module%20is%20not%20stable%20and%20it's%20causing%20a%20lot%20of%20issues%20due%20to%20poor%20replication.%20I%20would%20recommended%20to%20use%20Exchange%20Online%20PS%20module%20(unifiedgroup%20cmdlets).%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-290086%22%20slang%3D%22en-US%22%3ERe%3A%20Adding%20team%20members%20to%20a%20Team%20using%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290086%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Johan%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHave%20you%20tried%20using%20the%20Teams%20PowerShell%20Module%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FMicrosoftTeams%2F0.9.5%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FMicrosoftTeams%2F0.9.5%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt%20is%20still%20in%20beta%20(public%20preview)%2C%20that's%20something%20I%20have%20to%20mention.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMore%20info%20on%20commands%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmicrosoftteams%2Fteams-powershell-overview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmicrosoftteams%2Fteams-powershell-overview%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20could%20use%20A%3CSPAN%3Edd-TeamUser%20Cmdlet%20in%20order%20to%20add%20a%20user%20to%20a%20team.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-290070%22%20slang%3D%22en-US%22%3ERe%3A%20Adding%20team%20members%20to%20a%20Team%20using%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-290070%22%20slang%3D%22en-US%22%3EI%20find%20that%20the%20delay%20Add-UnifiedGroupLinks%20feeding%20through%20into%20SharePoint%20(from%20I%20assume%20Exchange)%20varies%20a%20lot.%20Happens%20with%20Office%20365%20groups%20too.%20I've%20just%20added%20two%20users%20to%20a%20group%20using%20the%20cmdlet%20and%2030%20minutes%20later%20they%20are%20still%20not%20showing%20up%20as%20members%20in%20the%20SharePoint%20site%20view.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-65356%22%20slang%3D%22en-US%22%3ERe%3A%20Adding%20team%20members%20to%20a%20Team%20using%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-65356%22%20slang%3D%22en-US%22%3E%3CP%3EDo%20you%20have%20any%20idea%20on%20the%20expected%20delay%20before%20they%20show%20up%20in%20the%20Team%20%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20did%20end%20up%20creating%20and%20using%20a%20Distribution%20List%2C%20since%20then%20the%20system%20send%20the%20invitation%20mails%20to%20the%20members%2C%20and%20they%20are%20added%20immediately.%20It%20should%20be%20possible%20to%20achieve%20the%20same%20using%20powershell%20(notifications%20etc.)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20replies.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-65265%22%20slang%3D%22en-US%22%3ERe%3A%20Adding%20team%20members%20to%20a%20Team%20using%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-65265%22%20slang%3D%22en-US%22%3ECorrect%2C%20no%20way%20to%20add%20users%20to%20a%20channel...this%20is%20just%20by%20design%2C%20users%20are%20added%20always%20at%20the%20Team%20level%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-65187%22%20slang%3D%22en-US%22%3ERe%3A%20Adding%20team%20members%20to%20a%20Team%20using%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-65187%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20is%20the%20correct%20approach%2C%20the%20user%20will%20appear%20in%20the%20Team%20eventually.%20But%20most%20of%20the%20operations%20with%20Groups%2FTeams%20are%20not%20immediately%20reflected%20due%20to%20the%20replication%20model%20user%2C%20as%20you%20have%20noted.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnd%20there's%20no%20way%20to%20add%20users%20to%20a%20channel%20afaik.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Johan Lindroos
Occasional Contributor

Hello,

 

Found based on previous questions it seems the following is the method to add members to a Microsoft Team team via Powershell.

 

Add-UnifiedGroupLinks -Identity team...

 

Could someone confirm is this the correct way to achieve this as this practically only adds the user to the Group hosting the team, the user does not show up in the team until some time as well he will not receive a notification of beeing addedd.

 

So, how do I add the user to the team in the correct way ?

 

a) so he receives an notification

b) so he shows up directly in the team

 

If not possible any idea on how long it takes for the "background" task to run so that the user shows up in the teams (15min or 24h?).

 

 

 

 

6 Replies

This is the correct approach, the user will appear in the Team eventually. But most of the operations with Groups/Teams are not immediately reflected due to the replication model user, as you have noted.

 

And there's no way to add users to a channel afaik.

Correct, no way to add users to a channel...this is just by design, users are added always at the Team level

Do you have any idea on the expected delay before they show up in the Team ?

 

I did end up creating and using a Distribution List, since then the system send the invitation mails to the members, and they are added immediately. It should be possible to achieve the same using powershell (notifications etc.)

 

Thank you for your replies.

I find that the delay Add-UnifiedGroupLinks feeding through into SharePoint (from I assume Exchange) varies a lot. Happens with Office 365 groups too. I've just added two users to a group using the cmdlet and 30 minutes later they are still not showing up as members in the SharePoint site view.

Hi Johan,

 

Have you tried using the Teams PowerShell Module?

 

https://www.powershellgallery.com/packages/MicrosoftTeams/0.9.5

 

It is still in beta (public preview), that's something I have to mention.

 

More info on commands:

 

https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-overview

 

You could use Add-TeamUser Cmdlet in order to add a user to a team. 

I will not recommended to use Teams PS module for now. Team's PS module is not stable and it's causing a lot of issues due to poor replication. I would recommended to use Exchange Online PS module (unifiedgroup cmdlets). 

Related Conversations