02-05-2019 08:33 AM
How do I get this to work?
$teams = Get-Team | Select-Object -Property GroupId
ForEach ($team in $teams) {
Add-TeamUser -GroupId $team -User Adam@bookkeepingissaquah.com
}
Error I get
02-05-2019 09:29 AM
SolutionYou are passing an incorrect value, GroupId needs to be string, while you are passing an object. Try this instead:
Add-TeamUser -GroupId $team.GroupId -User Adam@bookkeepingissaquah.com
02-05-2019 09:50 AM
So the user is already added, move to the next one.
05-25-2020 03:55 AM
Hi Zach,
I want to add user in MS Teams and I am trying to execute this code in Powershell and Management shell but I am unable to execute and getting below error. Could you please let me know which tool you have used to run this code? Your response will be very helpful to me.
Thankyou
01-08-2021 03:49 AM
Hi so I ran the following to do what you where looking at.
$teams = Import-CSV 'D:\Scripts\msteams.csv'
$teams|foreach{
Add-TeamUser -GroupId $_.GroupId -user <emailaddress> -Role Owner}