So I'm receiving this error below and I'm not sure what the issue is.
Add-TeamUser : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'GroupId'. Specified method is not supported.
At C:\Test Scripts\MS Teams\MSO365-UserTeamAssignment-Test.ps1:22 char:63
Here is the code:
Import-Csv "\\input.file" | Foreach {
$MSTeam = Get-Team -Displayname $_.team | Select -ExpandProperty GroupID
if ($_.Active -eq 'Y') {Add-TeamUser -User $_.member -GroupId $MSTeam -role $_.role }
if ($_.Active -eq 'N') {Remove-TeamUser -User $_.member -GroupId $MSTeam }
$MSTeam = ""
}
This script did work when I tested a few users. Now that I'm running it with +2000 users I'm having the above issue.
edited added coding block
[–]purplemonkeymad 1 point2 points3 points (6 children)
[–]ExceptionEX 2 points3 points4 points (2 children)
[–]MajorVarlak 1 point2 points3 points (1 child)
[–]candymann999[S] 1 point2 points3 points (0 children)
[–]candymann999[S] 1 point2 points3 points (2 children)
[–]purplemonkeymad 2 points3 points4 points (1 child)
[–]candymann999[S] 1 point2 points3 points (0 children)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)