Home

Add-TeamUser not adding users.

%3CLINGO-SUB%20id%3D%22lingo-sub-282900%22%20slang%3D%22en-US%22%3EAdd-TeamUser%20not%20adding%20users.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-282900%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20attempting%20to%20use%20Add-TeamUser%20to%20add%20people%20to%20newly%20created%20teams.%26nbsp%3B%20It%20seems%20that%20it%20doesn't%20add%20more%20than%20the%20first%20user.%26nbsp%3B%20%22Sometimes%22%20it%20works%20all%20the%20way.%26nbsp%3B%20I%20just%20created%20several%20teams%20and%20it%20was%20hit%20and%20miss%20if%20it%20worked.%26nbsp%3B%20Very%20weird.%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-282900%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-283650%22%20slang%3D%22en-US%22%3ERe%3A%20Add-TeamUser%20not%20adding%20users.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-283650%22%20slang%3D%22en-US%22%3E%3CP%3ETaking%20days%20to%20populate%20a%20change%20is%20pretty%20unacceptable.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-283649%22%20slang%3D%22en-US%22%3ERe%3A%20Add-TeamUser%20not%20adding%20users.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-283649%22%20slang%3D%22en-US%22%3E%3CP%3EI%20would%20look%20at%20the%20group%20through%20the%20Azure%20AD%20portal%20to%20see%20if%20the%20accounts%20are%20in%20there%2C%20that's%20the%20definitive%20place%20to%20define%20if%20someone%20is%20in%20a%20group.%20It's%20perhaps%20more%20likely%20that%20Teams%20hasn't%20picked%20up%20on%20the%20change%20yet%2C%20as%20mentioned%20above%20it%20can%20take%20a%20good%20while%20for%20changes%20to%20be%20reflected.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-283647%22%20slang%3D%22en-US%22%3ERe%3A%20Add-TeamUser%20not%20adding%20users.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-283647%22%20slang%3D%22en-US%22%3E%3CP%3EYeah%20I%20pretty%20much%20can't%20trust%20these%20commands.%26nbsp%3B%20My%20results%20are%20all%20over%20the%20place.%26nbsp%3B%20'Some'%20Teams%20got%20their%20members.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-282960%22%20slang%3D%22en-US%22%3ERe%3A%20Add-TeamUser%20not%20adding%20users.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-282960%22%20slang%3D%22en-US%22%3E%3CP%3EAre%20you%20using%20latest%20Teams%20PS%20module%20(0.9.5)%3F%20If%20not%2C%20try%20with%20that.%20As%20per%20MS%2C%20the%20sync%20time%20is%202%20hours%20but%20we%20have%20experienced%20more%20than%20that.%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20has%20been%20good%20improvement%20in%20latest%20module%20but%20still%20Teams%20PS%20module%20is%20in%20beta%20and%20will%20be%20improved.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20recommend%20to%20use%20Exchange%20Online%20module%20%22Unifiedgroup%22%20cmdlets.%20It's%20at%20least%20stable%20and%20works%20fine.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECheers.%3C%2FP%3E%3CP%3EH.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-282955%22%20slang%3D%22en-US%22%3ERe%3A%20Add-TeamUser%20not%20adding%20users.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-282955%22%20slang%3D%22en-US%22%3E%3CP%3EYes.%26nbsp%3B%20It%20completes.%26nbsp%3B%20Running%20it%20again%20shows%20an%20error%20like%20the%20command%20is%20already%20in%20queue.%26nbsp%3B%20Adding%20through%20the%20GUI%20eventually%20adds%20the%20person.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23ff0000%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3EAdd-TeamUser%20%3A%20Error%20occurred%20while%20executing%20Add-TeamUser%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECode%3A%20Request_BadRequest%3C%2FP%3E%3CP%3EMessage%3A%20One%20or%20more%20added%20object%20references%20already%20exist%20for%20the%20following%20modified%20properties%3A%20'owners'.%3C%2FP%3E%3CP%3EInnerError%3A%3C%2FP%3E%3CP%3ERequestId%3A%2011ef0494-40da-4ea4-b682-b2ec2f3128fe%3C%2FP%3E%3CP%3EDateTimeStamp%3A%202018-11-06T16%3A05%3A10%3C%2FP%3E%3CP%3EHttpStatusCode%3A%20Request_BadRequest%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-282948%22%20slang%3D%22en-US%22%3ERe%3A%20Add-TeamUser%20not%20adding%20users.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-282948%22%20slang%3D%22en-US%22%3E%3CP%3EDoes%20the%20script%20run%20100%25%20cleanly%2C%20nothing%20is%20rejected%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-282901%22%20slang%3D%22en-US%22%3ERe%3A%20Add-TeamUser%20not%20adding%20users.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-282901%22%20slang%3D%22en-US%22%3E%3CP%3ECode%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%2300008b%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3Eforeach%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%20(%3C%2FFONT%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24item%3C%2FFONT%3E%20%3CFONT%20color%3D%22%2300008b%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3Ein%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24csv%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E)%7B%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24item%3C%2FFONT%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E.%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3ETeamName%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24team%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3D%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000ff%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3ENew-Team%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E-alias%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24item%3C%2FFONT%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E.%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3ETeamName%3C%2FFONT%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E.%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3Ereplace(%3C%2FFONT%3E%3CFONT%20color%3D%22%238b0000%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E'%20'%3C%2FFONT%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%2C%3C%2FFONT%3E%3CFONT%20color%3D%22%238b0000%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E''%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E)%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E-displayname%3C%2FFONT%3E%20%3CFONT%20color%3D%22%238b0000%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%22%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24(%3C%2FFONT%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24item%3C%2FFONT%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E.%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3ETeamName)%3C%2FFONT%3E%3CFONT%20color%3D%22%238b0000%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%22%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E-AccessType%3C%2FFONT%3E%20%3CFONT%20color%3D%22%238b0000%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%22private%22%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%230000ff%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3EStart-Sleep%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E-Seconds%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23800080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E5%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%2300008b%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3Eforeach%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%20(%3C%2FFONT%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24owner%3C%2FFONT%3E%20%3CFONT%20color%3D%22%2300008b%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3Ein%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24item%3C%2FFONT%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E.%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3ETeamOwner%3C%2FFONT%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E.%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3ESplit(%3C%2FFONT%3E%3CFONT%20color%3D%22%238b0000%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%22%3B%22%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E))%7B%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24owner%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%230000ff%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3EAdd-TeamUser%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E-GroupId%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24team%3C%2FFONT%3E%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E.%3C%2FFONT%3E%3CFONT%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3EGroupId%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E-User%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24owner%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E-Role%3C%2FFONT%3E%20%3CFONT%20color%3D%22%238a2be2%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3EOwner%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%230000ff%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3EStart-Sleep%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23000080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E-Seconds%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23800080%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E5%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3E%E3%80%80%3C%2FP%3E%3CP%3E%E3%80%80%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3C%2FLINGO-BODY%3E
David Jenkins
Occasional Contributor

I'm attempting to use Add-TeamUser to add people to newly created teams.  It seems that it doesn't add more than the first user.  "Sometimes" it works all the way.  I just created several teams and it was hit and miss if it worked.  Very weird. 

 

 

7 Replies

Code:

foreach ($item in $csv){

$item.TeamName

$team = New-Team -alias $item.TeamName.replace(' ','') -displayname "$($item.TeamName)" -AccessType "private"

Start-Sleep -Seconds 5

foreach ($owner in $item.TeamOwner.Split(";")){

$owner

Add-TeamUser -GroupId $team.GroupId -User $owner -Role Owner

Start-Sleep -Seconds 5

 

}

 

 

}

Does the script run 100% cleanly, nothing is rejected ?

Yes.  It completes.  Running it again shows an error like the command is already in queue.  Adding through the GUI eventually adds the person.

Add-TeamUser : Error occurred while executing Add-TeamUser

 

Code: Request_BadRequest

Message: One or more added object references already exist for the following modified properties: 'owners'.

InnerError:

RequestId: 11ef0494-40da-4ea4-b682-b2ec2f3128fe

DateTimeStamp: 2018-11-06T16:05:10

HttpStatusCode: Request_BadRequest

 



 

 

Are you using latest Teams PS module (0.9.5)? If not, try with that. As per MS, the sync time is 2 hours but we have experienced more than that. 

There has been good improvement in latest module but still Teams PS module is in beta and will be improved. 

 

I would recommend to use Exchange Online module "Unifiedgroup" cmdlets. It's at least stable and works fine.

 

Cheers.

H.

Yeah I pretty much can't trust these commands.  My results are all over the place.  'Some' Teams got their members.

I would look at the group through the Azure AD portal to see if the accounts are in there, that's the definitive place to define if someone is in a group. It's perhaps more likely that Teams hasn't picked up on the change yet, as mentioned above it can take a good while for changes to be reflected.

Taking days to populate a change is pretty unacceptable.

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
35 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies